Elide the vm_reserv_free_page() call when PG_PCPU_CACHE is set.

Pages with PG_PCPU_CACHE set cannot have been allocated from a
reservation, so as an optimization, skip the call to
vm_reserv_free_page() in this case.  Otherwise, the access of
the corresponding reservation structure often results in a cache
miss.

Reviewed by:	alc, kib
Discussed with:	jeff
MFC after:	2 weeks
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20859
This commit is contained in:
Mark Johnston 2019-07-08 19:02:40 +00:00
parent d9a73522e3
commit 46736e306c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349841

View File

@ -3491,7 +3491,12 @@ vm_page_free_prep(vm_page_t m)
pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT);
#if VM_NRESERVLEVEL > 0
if (vm_reserv_free_page(m))
/*
* Determine whether the page belongs to a reservation. If the page was
* allocated from a per-CPU cache, it cannot belong to a reservation, so
* as an optimization, we avoid the check in that case.
*/
if ((m->flags & PG_PCPU_CACHE) == 0 && vm_reserv_free_page(m))
return (false);
#endif