Skip to content

Commit 3ab28c8

Browse files
committed
Improve category_* docs
Basically forward to the Linux kernel source itself.
1 parent 6157b96 commit 3ab28c8

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

crates/wasmtime/src/runtime/vm/sys/unix/pagemap.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,25 +346,38 @@ mod ioctl {
346346
/// categories before testing for `category_mask`. That means that if a
347347
/// bit needs to be zero then it additionally must be specified in one
348348
/// of `category_mask` or `category_anyof_mask`.
349+
///
350+
/// For more detail see the `pagemap_scan_is_interesting_page` function
351+
/// in the Linux kernel source.
349352
pub fn category_inverted(&mut self, flags: Categories) -> &mut PageMapScanBuilder {
350353
self.pm_scan_arg.category_inverted = flags;
351354
self
352355
}
353356

354-
/// Skip pages for which any category doesn't match.
357+
/// Only consider pages for which all `flags` match.
355358
///
356359
/// This mask is applied after `category_inverted` is used to flip bits
357360
/// in a page's categories. Only pages which match all bits in `flags`
358361
/// will be considered.
362+
///
363+
/// For more detail see the `pagemap_scan_is_interesting_page` function
364+
/// in the Linux kernel source.
359365
pub fn category_mask(&mut self, flags: Categories) -> &mut PageMapScanBuilder {
360366
self.pm_scan_arg.category_mask = flags;
361367
self
362368
}
363369

364-
/// Skip pages for which no category matches.
370+
/// Only consider pages for which any bit of `flags` matches.
371+
///
372+
/// After `category_inverted` and `category_mask` have been applied, if
373+
/// this option is specified to a non-empty value, then at least one of
374+
/// `flags` must be in a page's flags to be considered. That means that
375+
/// flags specified in `category_inverted` will already be inverted for
376+
/// consideration here. The page categories are and'd with `flags` and
377+
/// some bit must be set for the page to be considered.
365378
///
366-
/// Like `category_mask` this is applied after pages have had their category
367-
/// bits inverted by `category_inverted`.
379+
/// For more detail see the `pagemap_scan_is_interesting_page` function
380+
/// in the Linux kernel source.
368381
#[expect(dead_code, reason = "bindings for the future if we need them")]
369382
pub fn category_anyof_mask(&mut self, flags: Categories) -> &mut PageMapScanBuilder {
370383
self.pm_scan_arg.category_anyof_mask = flags;

0 commit comments

Comments
 (0)