FreeBSD/sys/kern/kern_sendfile.c
/*
 * Detach mapped page and release resources back to the system.  Called
 * by mbuf(9) code when last reference to a page is freed.
 */
Detach mapped page and release resources back to the system.  Called
by mbuf(9) code when last reference to a page is freed.
Detach mapped page and release resources back to the system . Called by mbuf ( 9 ) code when last reference to a page is freed .
void
sf_ext_free(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_INACTIVE) && pg->object == NULL)
		vm_page_free(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 ( 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_INACTIVE ) && pg -> object == NULL ) vm_page_free ( 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 ) ; } }
Detach mapped page and release resources back to the system.
Detach mapped page and release resources back to the system .
/*
	 * Check for the object going away on us. This can
	 * happen since we don't hold a reference to it.
	 * If so, we're responsible for freeing the page.
	 */