From owner-freebsd-current Sun Jan 19 02:17:09 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id CAA25787 for current-outgoing; Sun, 19 Jan 1997 02:17:09 -0800 (PST) Received: from scrooge.ee.swin.oz.au (scrooge.ee.swin.oz.au [136.186.4.20]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id CAA25782 for ; Sun, 19 Jan 1997 02:17:03 -0800 (PST) Received: (from dtc@localhost) by scrooge.ee.swin.oz.au (8.6.9/8.6.9) id VAA09832 for current@freebsd.org; Sun, 19 Jan 1997 21:19:06 +1100 From: Douglas Thomas Crosher Message-Id: <199701191019.VAA09832@scrooge.ee.swin.oz.au> Subject: possible madvise MADV_FREE improvement To: current@freebsd.org Date: Sun, 19 Jan 1997 21:19:06 +1100 (EST) X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Below is a patch which seems to improve madvise MADV_FREE; stops the page-ins in the example recently posted. It also brings the call closer to reliably zeroing the pages. Regards Douglas Crosher -=-=- *** vm_object.c.1 Thu Jan 16 16:12:54 1997 --- vm_object.c Sun Jan 19 21:05:45 1997 *************** *** 697,702 **** --- 697,703 ---- { vm_pindex_t end; vm_page_t m; + int s; if (object == NULL) return; *************** *** 714,721 **** if (m == NULL || m->busy || (m->flags & PG_BUSY) || m->hold_count || m->wire_count || m->valid != VM_PAGE_BITS_ALL) ! continue; ! if (advise == MADV_WILLNEED) { if (m->queue != PQ_ACTIVE) vm_page_activate(m); --- 715,736 ---- if (m == NULL || m->busy || (m->flags & PG_BUSY) || m->hold_count || m->wire_count || m->valid != VM_PAGE_BITS_ALL) ! { ! if ( (advise!=MADV_FREE) || ! ((object->type != OBJT_DEFAULT) && ! (object->type != OBJT_SWAP)) ) ! continue; ! else if (m == NULL) { ! swap_pager_dmzspace(object, pindex, 1); ! continue; ! } else if ( m->busy || (m->flags & PG_BUSY) ) { ! s = splvm(); ! m->flags |= PG_WANTED; ! tsleep(m, PVM, "mafree", 0); ! splx(s); ! } ! } ! if (advise == MADV_WILLNEED) { if (m->queue != PQ_ACTIVE) vm_page_activate(m);