FreeBSD/sys/kern/kern_sendfile.c
/*
 * Same as above, but forces the page to be detached from the object
 * and go into free pool.
 */
Same as above, but forces the page to be detached from the object
and go into free pool.
Same as above but forces the page to be detached from the object and go into free pool .
void
sf_ext_free_nocache(void *arg1, void *arg2)
{
	struct sf_buf *sf = arg1;
	struct sendfile_sync *sfs = arg2;
	vm_page_t pg = sf_buf_page(sf);
	sf_buf_free(sf);
	vm_page_lock(pg);
	if (vm_page_unwire(pg, PQ_NONE)) {
		vm_object_t obj;
		if ((obj = pg->object) == NULL)
			vm_page_free(pg);
		else if (!vm_page_xbusied(pg) && VM_OBJECT_TRYWLOCK(obj)) {
			vm_page_free(pg);
			VM_OBJECT_WUNLOCK(obj);
		} else
			vm_page_deactivate(pg);
	}
	vm_page_unlock(pg);
	if (sfs != NULL) {
		mtx_lock(&sfs->mtx);
		KASSERT(sfs->count > 0, ("Sendfile sync botchup count == 0"));
		if (--sfs->count == 0)
			cv_signal(&sfs->cv);
		mtx_unlock(&sfs->mtx);
	}
}
void sf_ext_free_nocache ( void * arg1 , void * arg2 ) { struct sf_buf * sf = arg1 ; struct sendfile_sync * sfs = arg2 ; vm_page_t pg = sf_buf_page ( sf ) ; sf_buf_free ( sf ) ; vm_page_lock ( pg ) ; if ( vm_page_unwire ( pg , PQ_NONE ) ) { vm_object_t obj ; if ( ( obj = pg -> object ) == NULL ) vm_page_free ( pg ) ; else if ( ! vm_page_xbusied ( pg ) && VM_OBJECT_TRYWLOCK ( obj ) ) { vm_page_free ( pg ) ; VM_OBJECT_WUNLOCK ( obj ) ; } else vm_page_deactivate ( pg ) ; } vm_page_unlock ( pg ) ; if ( sfs != NULL ) { mtx_lock ( & sfs -> mtx ) ; KASSERT ( sfs -> count > 0 , ( " " ) ) ; if ( -- sfs -> count == 0 ) cv_signal ( & sfs -> cv ) ; mtx_unlock ( & sfs -> mtx ) ; } }
Same as above, but forces the page to be detached from the object
 and go into free pool.
Same as above but forces the page to be detached from the object and go into free pool .
/* Try to free the page, but only if it is cheap to. */