From owner-freebsd-current Thu Sep 3 15:31:14 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA07018 for freebsd-current-outgoing; Thu, 3 Sep 1998 15:31:14 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from smtp03.primenet.com (smtp03.primenet.com [206.165.6.133]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id PAA06994 for ; Thu, 3 Sep 1998 15:31:01 -0700 (PDT) (envelope-from tlambert@usr09.primenet.com) Received: (from daemon@localhost) by smtp03.primenet.com (8.8.8/8.8.8) id PAA14957; Thu, 3 Sep 1998 15:29:48 -0700 (MST) Received: from usr09.primenet.com(206.165.6.209) via SMTP by smtp03.primenet.com, id smtpd014926; Thu Sep 3 15:29:44 1998 Received: (from tlambert@localhost) by usr09.primenet.com (8.8.5/8.8.5) id PAA02145; Thu, 3 Sep 1998 15:29:36 -0700 (MST) From: Terry Lambert Message-Id: <199809032229.PAA02145@usr09.primenet.com> Subject: Re: VM question To: abial@nask.pl (Andrzej Bialecki) Date: Thu, 3 Sep 1998 22:29:35 +0000 (GMT) Cc: tlambert@primenet.com, freebsd-current@FreeBSD.ORG In-Reply-To: from "Andrzej Bialecki" at Sep 3, 98 10:35:57 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > It makes no sense to do this. These pages aren't bothering anyone, > > and will go away when it is necessary for them to do so. > > I think from my point of view it _is_ necessary to free as much as > possible (including .text and .data pages of other processes) in order to > be able to start the new process; And this is precisely what *will* happen. When unused cached pages compete with new pages, the old pages lose, and are replaced. What you are suggesting is throwing away cached pages that may be about to be reused because you think that maybe later you will load something else. The tiny increase in speed in mapping new pages vs. unmapping old pages and then mapping new pages, is not worth the cost in cache locality losses, unless you are regenerating your executables each time. Even then, as the CS department of the University of Utah was able to dramatically demonstrate, keeping around pre-relocated chunks of code for mapping into process address spaces is still a win. The only place I can think of where this would not be a win is a Symbolic's LISP machine, a UCSD P-code machine, or a JAVA chip. At that point, though, it's not an issue for a FreeBSD VM any more, since you wouldn't be running FreeBSD. > and to do the same to the newly started process when its turn to > run ends. Of course this will result in excessive paging, but these > will be only page-ins and discards, right? I am unconcerned about the page-in's, given the architecture you have described. I am more concerned about tearing down page tables and PTE's for VM objects that aren't taking up space, and which might otherwise be reused. Realize that by doing this, you will be engaging in L1 and L2 cache busting, and unless your I/O and memory bus speeds are the same as L2 cache access (minimally), then what you are doing is a pessimization. > What happens to clean pages in normal situation, i.e. with swap? Are they > just discarded when system is low on memory, or are they swapped together > with dirty pages? They are discarded. > All I want here (i.e. without swap) is to discard as > many (all?) clean pages as possible, because I can always (quickly) reload > them if they are referenced; as far as I understand this, this is not the > current behaviour, which is to keep as many pages as possible either > loaded or swapped out. Clean pages are not written to swap. See PHK's correction to an article I wrote where I had errnously reported that they were. In fact, clean pages *should* be written to swap, rather than discarded, both because the swap pager is faster than the vnode pager (and always will be) for reading pages in, so you might as well swap them if you can. Not that this matters, since you said you will be setting NO_SWAPPING (the same as not cinfiguring any swap space). > > I estimate that you will save, on average, on text page by doing this. > ^-- one > You mean, one page for each page of .text - this is not negligible gain... One page of text per file. > > > * to limit killing of random user processes - instead the VM should try > > > first to free as much pages as possible (and it should try better than it > > > is doing now :-) > > > > There are two problems glossed together here: > > > > 1) What if you really *are* out of memory? > > Let me rephrase this: what if my memory is filled with dirty pages? Then > resort to killing. BUT: what if my memory is filled with some dirty pages > and some clean pages? IMHO, I should free the clean pages immediately > (except one-two which are being referenced just now :-) The clean pages will be displaced by dirty pages, as needed. That's how it works. > Yes, if we're talking about dirty pages. But I'd bet in current schema > there are many clean pages kept in-core in order to avoid excessive > paging. I need to change this to bare minimum, because I don't consider > page-ins from MFS to be expensive. But by doing this, you won't get more usable memory, so what's the point? Better to rewrite MFS, in the way I have suggested... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message