From owner-freebsd-hackers Wed Oct 29 12:57:11 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id MAA13656 for hackers-outgoing; Wed, 29 Oct 1997 12:57:11 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from heron.doc.ic.ac.uk (DOZY6i9gvBSFx6Plkw67QUsktaeQYnhQ@heron.doc.ic.ac.uk [146.169.2.31]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id MAA13650 for ; Wed, 29 Oct 1997 12:57:08 -0800 (PST) (envelope-from njs3@doc.ic.ac.uk) Received: from oak67.doc.ic.ac.uk [146.169.33.67] ([Gaf7PZncXCDWA/L0g6Ja6juj+LQAFsor]) by heron.doc.ic.ac.uk with smtp (Exim 1.62 #3) id 0xQf5D-0004vw-00; Wed, 29 Oct 1997 20:51:19 +0000 Received: from njs3 by oak67.doc.ic.ac.uk with local (Exim 1.62 #3) id 0xQf52-0006j9-00; Wed, 29 Oct 1997 20:51:08 +0000 From: njs3@doc.ic.ac.uk (Niall Smart) Date: Wed, 29 Oct 1997 20:51:08 +0000 In-Reply-To: Terry Lambert "Re: help with fstat?" (Oct 29, 8:04pm) X-Mailer: Mail User's Shell (7.2.5 10/14/92) To: Terry Lambert Subject: Re: help with fstat? Cc: freebsd-hackers@freebsd.org Message-Id: Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Oct 29, 8:04pm, Terry Lambert wrote: > If I have a clean page on the LRU already, will the MADV_SEQUENTIAL > prevent a byte-based traversal of an mmap()'ed file larger than > memory+swap from discarding my page? > > My desired behaviour is to that the system not force out my clean > page in favor of the more recently used, but never again to be > referenced, pages of an MADV_SEQUENTIAL file. > > I want the system to *not* preferentially save newer pages than mine, > if the newer pages came from an MADV_SEQUENTIAL marked region, and > my page did not. I'd consider normal use of the LRU by pages from > an MADV_SEQUENTIAL marked region to be "cache thrashing", by definition. > > I'd like it to *reuse* pages in that region before going to the LRU > and endangering the "in core" state of my page. Does FreeBSD maintain a "free page" list internally that it will consult before trying the heuristics for replacing a page? If this is so then when we page in a page for a memory mapped region with the MADV_SEQUENTIAL attribute we can immediately add the previous page to the "free page" list. If there is no such "free page" list then perhaps it would be prudent to introduce one or somehow modify the page replacement heuristics to take into account those pages the we are pretty sure will never be used again - perhaps they can be folded into the bottom of the LRU list. As I know absolutely nothing about FreeBSD's memory management internals and don't have the time or source to check the above comments may be entirely useless. Niall