HomeFreeBSD

Address two problems with sendfile(..., SF_NOCACHE) and apply one

Description

Address two problems with sendfile(..., SF_NOCACHE) and apply one
"optimization". First, sendfile(..., SF_NOCACHE) frees pages without
checking whether those pages are mapped. This can leave the system
with mappings to free or repurposed pages. Second, a page can be
busied between the time of the current busy test and acquiring the
object lock. Essentially, the test performed before the object lock
is acquired can only be regarded as an optimization to short-circuit
further work on the page. It cannot, however, be relied upon to prove
that it is safe to free the page. Third, when sendfile(..., SF_NOCACHE)
was originally implemented, vm_page_deactivate_noreuse() did not yet
exist. Use vm_page_deactivate_noreuse() instead of vm_page_deactivate(),
because it comes closer to freeing the page.

In collaboration with: glebius
Discussed with: gallatin, kib, markj
X-MFC after: r324448

Details

Provenance
alcAuthored on
Parents
rS324600: Evaluate the real size of the sblk_zone.
Branches
Unknown
Tags
Unknown