diff options
author | Alan Cox <alc@FreeBSD.org> | 2017-07-14 02:15:48 +0000 |
---|---|---|
committer | Alan Cox <alc@FreeBSD.org> | 2017-07-14 02:15:48 +0000 |
commit | 883026012849bf676d4f43ffa1150ec4b6f1a217 (patch) | |
tree | 59594df8c2ec9871ad14b1bffc97942a0af6d4be /sys/vm/vm_page.c | |
parent | 33c66d8aebf76dd0436843e887133b810bb93c71 (diff) | |
download | src-883026012849bf676d4f43ffa1150ec4b6f1a217.tar.gz src-883026012849bf676d4f43ffa1150ec4b6f1a217.zip |
Generalize vm_page_ps_is_valid() to support testing other predicates on
the (super)page, renaming the function to vm_page_ps_test().
Reviewed by: kib, markj
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=320980
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r-- | sys/vm/vm_page.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 66279a243c6e..20d24fd194e8 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -3472,12 +3472,11 @@ vm_page_is_valid(vm_page_t m, int base, int size) } /* - * vm_page_ps_is_valid: - * - * Returns TRUE if the entire (super)page is valid and FALSE otherwise. + * Returns true if all of the specified predicates are true for the entire + * (super)page and false otherwise. */ -boolean_t -vm_page_ps_is_valid(vm_page_t m) +bool +vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m) { int i, npages; @@ -3490,10 +3489,25 @@ vm_page_ps_is_valid(vm_page_t m) * occupy adjacent entries in vm_page_array[]. */ for (i = 0; i < npages; i++) { - if (m[i].valid != VM_PAGE_BITS_ALL) - return (FALSE); + if (&m[i] == skip_m) + continue; + if ((flags & PS_NONE_BUSY) != 0 && vm_page_busied(&m[i])) + return (false); + if ((flags & PS_ALL_DIRTY) != 0) { + /* + * Calling vm_page_test_dirty() or pmap_is_modified() + * might stop this case from spuriously returning + * "false". However, that would require a write lock + * on the object containing "m[i]". + */ + if (m[i].dirty != VM_PAGE_BITS_ALL) + return (false); + } + if ((flags & PS_ALL_VALID) != 0 && + m[i].valid != VM_PAGE_BITS_ALL) + return (false); } - return (TRUE); + return (true); } /* |