Skip to content

macos: update vm_statistics64 to latest sdk#5253

Open
elihwyma wants to merge 1 commit into
rust-lang:mainfrom
elihwyma:main
Open

macos: update vm_statistics64 to latest sdk#5253
elihwyma wants to merge 1 commit into
rust-lang:mainfrom
elihwyma:main

Conversation

@elihwyma

@elihwyma elihwyma commented Jul 5, 2026

Copy link
Copy Markdown

Description

Updates vm_statistics64 to include the new values added in more recent MacOS SDK versions.

Sources

Relevant header snippet from MacOS27.sdk

struct vm_statistics64 {
	natural_t       free_count;             /* # of pages free */
	natural_t       active_count;           /* # of pages active */
	natural_t       inactive_count;         /* # of pages inactive */
	natural_t       wire_count;             /* # of pages wired down */
	uint64_t        zero_fill_count;        /* # of zero fill pages */
	uint64_t        reactivations;          /* # of pages reactivated */
	uint64_t        pageins;                /* # of pageins (lifetime) */
	uint64_t        pageouts;               /* # of pageouts */
	uint64_t        faults;                 /* # of faults */
	uint64_t        cow_faults;             /* # of copy-on-writes */
	uint64_t        lookups;                /* object cache lookups */
	uint64_t        hits;                   /* object cache hits */
	uint64_t        purges;                 /* # of pages purged */
	natural_t       purgeable_count;        /* # of pages purgeable */
	/*
	 * NB: speculative pages are already accounted for in "free_count",
	 * so "speculative_count" is the number of "free" pages that are
	 * used to hold data that was read speculatively from disk but
	 * haven't actually been used by anyone so far.
	 */
	natural_t       speculative_count;      /* # of pages speculative */

	/* added for rev1 */
	uint64_t        decompressions;         /* # of pages decompressed (lifetime) */
	uint64_t        compressions;           /* # of pages compressed (lifetime) */
	uint64_t        swapins;                /* # of pages swapped in via compressor segments (lifetime) */
	uint64_t        swapouts;               /* # of pages swapped out via compressor segments (lifetime) */
	natural_t       compressor_page_count;  /* # of pages used by the compressed pager to hold all the compressed data */
	natural_t       throttled_count;        /* # of pages throttled */
	natural_t       external_page_count;    /* # of pages that are file-backed (non-swap) */
	natural_t       internal_page_count;    /* # of pages that are anonymous */
	uint64_t        total_uncompressed_pages_in_compressor; /* # of pages (uncompressed) held within the compressor. */
	/* added for rev2 */
	uint64_t        swapped_count;          /* # of compressor-stored pages currently stored in swap */
	/* Added in rev3 */
	/* The total number of physical pages in the tag storage region */
	uint64_t total_tag_storage_pages;
	/*
	 * The number of tag storage pages which hold non-tag data and are pageable
	 */
	uint64_t nontag_pageable_tag_storage_pages;
	/* The number of tag storage pages which hold non-tag data and are wired */
	uint64_t nontag_wired_tag_storage_pages;
	/*
	 * The number of tag storage pages which are being used for neither tags nor
	 * regular memory
	 */
	uint64_t free_tag_storage_pages;
	/* The number of tag storage pages which currently hold tags */
	uint64_t tag_storing_tag_storage_pages;

	/* The total number of virtual pages which are tagged */
	uint64_t total_tagged_pages;
	/* The number of resident, physical pages which are tagged */
	uint64_t resident_tagged_pages;
	/*
	 * The outstanding number of virtual tagged pages whose contents reside in the
	 * compressor
	 */
	uint64_t compressed_tagged_pages;

	/* The number of tagged pages which have been compressed since boot */
	uint64_t tagged_compressions;
	/* The number of tagged pages which have been decompressed since boot */
	uint64_t tagged_decompressions;
	/* The current number of bytes consumed by compressed tag storage data */
	uint64_t compressed_tag_storage_bytes;
	/* added for rev4 */
	/* The number of pages created due to speculative prefetch since boot */
	uint64_t speculative_pages_created;
	/* The number speculative pages that have been activated since boot */
	uint64_t speculative_pages_activated;

	/* Added for rev4 */
	/* The number of pages currently populated in the swapfile */
	uint64_t swap_count;

	/* Added for rev5 */
	/*
	 * The number of tag storage pages which are reserved for storing tags but
	 * don't currently hold any
	 */
	uint64_t empty_tag_storing_tag_storage_pages;
	/*
	 * The number of resident, file-backed (i.e. excluding JIT) pages which are
	 * mapped as executable
	 */
	uint64_t executable_count;
	/* The number of resident pages which are part of a shared region */
	uint64_t shared_region_count;
	/* The number of pages stolen by the booter */
	uint64_t boot_stolen_count;
	/* The number of file-backed pages which are secluded */
	uint64_t secluded_count;
	/* The number of internal pageable pages which are active */
	uint64_t active_internal_count;
	/* The number of internal pageable pages which are inactive */
	uint64_t inactive_internal_count;
	/* The number of external pageable pages which are active */
	uint64_t active_external_count;
	/* The number of external pageable pages which are inactive */
	uint64_t inactive_external_count;
	/* The number of purgeable volatile pages which are pageable */
	uint64_t purgeable_pageable_count;
	/* The number of purgeable-volatile pages which are wired */
	uint64_t purgeable_wired_count;
	/* The number of anonymous pages which are backgrounded */
	uint64_t background_internal_count;
	/* The number of file-backed pages which are backgrounded */
	uint64_t background_external_count;
	/* The number of anonymous pages which are queued for self-donation (App Swap) */
	uint64_t donated_count;
	/* The number of anonymous pages which are marked as real-time */
	uint64_t realtime_count;
	/* The size of physical memory in pages */
	uint64_t max_mem_count;
	/* The number of phantom file-cache ghosts which were re-paged-in */
	uint64_t phantom_ghosts_found;
	/* The number of phantom file-cache ghosts created by pageout */
	uint64_t phantom_ghosts_added;
} __attribute__((aligned(8)));

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 5, 2026
@elihwyma elihwyma changed the title feat: update vm_statistics64 to latest sdk macos: update vm_statistics64 to latest sdk Jul 5, 2026
@rustbot

This comment has been minimized.

@rustbot

rustbot commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • The following commits have merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

    You can start a rebase with the following commands:

    $ # rebase
    $ git pull --rebase https://github.com/rust-lang/libc.git main
    $ git push --force-with-lease
    

@rustbot

rustbot commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants