This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Sat Apr 20 03:16:35 2024 Received: from spaans.ds9a.nl (adsl-xs4all.ds9a.nl [213.84.159.51]) by kylie.puddingonline.com (8.11.6/8.11.6) with SMTP id g8II2TX01988 for ; Wed, 18 Sep 2002 20:02:30 +0200 Received: (qmail 30550 invoked from network); 18 Sep 2002 06:53:22 -0000 Received: from unknown (HELO spaans.ds9a.nl) (3ffe:8280:10:360:202:44ff:fe2a:a1dd) by mayo.ipv6.ds9a.nl with SMTP; 18 Sep 2002 06:53:22 -0000 Received: (qmail 7722 invoked by uid 1000); 17 Sep 2002 20:28:20 -0000 Received: (maildatabase); juh Received: (qmail 32724 invoked by alias); 18 Sep 2001 17:37:46 -0000 Received: (qmail 32721 invoked from network); 18 Sep 2001 17:37:45 -0000 Received: from vvtp.tn.tudelft.nl (HELO vvtp.nl) (qmailr@130.161.252.29) by spaans-smp.ds9a.tudelft.nl with SMTP; 18 Sep 2001 17:37:45 -0000 Received: (qmail 25260 invoked by uid 2547); 18 Sep 2001 17:36:16 -0000 Received: (qmail 25130 invoked from network); 18 Sep 2001 17:36:14 -0000 Received: from vger.kernel.org (199.183.24.194) by vvtp.tn.tudelft.nl with SMTP; 18 Sep 2001 17:36:14 -0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 18 Sep 2001 13:34:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 18 Sep 2001 13:33:52 -0400 Received: from caracal.noc.ucla.edu ([169.232.10.11]:12466 "EHLO caracal.noc.ucla.edu") by vger.kernel.org with ESMTP id ; Tue, 18 Sep 2001 13:33:50 -0400 Received: from ucla.edu (ts48-24.dialup.bol.ucla.edu [164.67.27.225]) by caracal.noc.ucla.edu (8.9.1a/8.9.1) with ESMTP id KAA06155; Tue, 18 Sep 2001 10:32:28 -0700 (PDT) Message-Id: <3BA78561.27A89CF1@ucla.edu> Date: Tue, 18 Sep 2001 10:33:21 -0700 From: Benjamin Redelings I X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.10-pre10 i686) X-Accept-Language: en Mime-Version: 1.0 To: linux-mm@kvack.org, Linus Torvalds , Marcelo Tosatti , Daniel Phillips , Rik van Riel Cc: linux-kernel@vger.kernel.org Subject: [PATCH] Make 2.4.10-pre10 use page->age [BUG] swap death Content-Type: multipart/mixed; boundary="------------BAFE1D8C4B63FED01B751AB1" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) This is a multi-part message in MIME format. --------------BAFE1D8C4B63FED01B751AB1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Here is a patch (also included as a MIME attatchment) which does 2 things: 1. Make page aging be +3 for use and -1 for no use. I think that Rik reported that this works well, and is what BSD uses? 2. Make try_to_swap_out use page->age in deciding which pages to deactivate. This should work well and quite simply, by extending the logic that Linus added: Linus's logic rephrased (I think): a) if a page is inactive-clean [reclaim_page]  scanning the list moves references pages to front of list double-referenced pages move to inactive-dirty b) if a page is inactive-dirty [page_launder]  scanning the list moves referenced pages to front of list double-referenced pages move to inactive-dirty c) if a page is active [refill_inactive_scan] scanning the list: ages up referenced pages, ages down unreferenced pages (but we ignore the ages) don't swap out referenced pages So, on the active list, referenced bits are converted to age. If we think of the referenced bit as an age with only two values, then page->age is like a referenced-COUNT instead of a referenced BIT. So age is like a proxy for the referenced bit that simply has more than two states. The result of this is that we deactivate the page only if it has page->age==0 AND is unreferenced (which will soon be converted into a positive age). This patch seems to work well. It gives much better interactive feel that 2.4.10-pre4 on low-memory boxes (e.g. 64Mb RAM), although I don't know how much of that is due to Linus and how much is due to this small change. However, with this patch my box swapped to death, using all available 64Mb memory and 128Mb swap running only netscape and 'find'. So I presume that around 128Mb of 'find' pages got swapped out. The cache shrunk to about 1 Mb before the system froze doing heavy disk activity but not responding to mouse movements, although I got it back by pressing Alt-SysReq-K and killing x-windows. Is there any reason to think that this is a result of the patch below, and not a problem with 2.4.10-pre10? People have been reporting smaller cache sizes. 1. Could this be because mark_page_accessed has no effect on pages on the active list if they already marked referenced? e.g. maybe I need to add to mark_page_accessed: + if (PageActive(page) && PageReferenced(page)) { + age_page_up(page); + ClearPageReferenced(page); + return; + } 2. Could this be because Linus removed Daniel Phillips hack which marked swapped-in pages referenced? thanks, -benRI --- vmscan.c.old Tue Sep 18 09:49:16 2001 +++ vmscan.c Tue Sep 18 09:49:46 2001 @@ -42,7 +42,8 @@ static inline void age_page_down(struct page * page) { - page->age /= 2; + if (page->age>0) + page->age--; } /* @@ -127,7 +128,7 @@ set_pte(page_table, swp_entry_to_pte(entry)); drop_pte: mm->rss--; - if (!PageReferenced(page)) + if (!PageReferenced(page) && !page->age) deactivate_page(page); UnlockPage(page); page_cache_release(page); -- "I will begin again" - U2, 'New Year's Day' Benjamin Redelings I <>< http://www.bol.ucla.edu/~bredelin/ --------------BAFE1D8C4B63FED01B751AB1 Content-Type: text/plain; charset=us-ascii; name="aging.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="aging.diff" --- vmscan.c.old Tue Sep 18 09:49:16 2001 +++ vmscan.c Tue Sep 18 09:49:46 2001 @@ -42,7 +42,8 @@ static inline void age_page_down(struct page * page) { - page->age /= 2; + if (page->age>0) + page->age--; } /* @@ -127,7 +128,7 @@ set_pte(page_table, swp_entry_to_pte(entry)); drop_pte: mm->rss--; - if (!PageReferenced(page)) + if (!PageReferenced(page) && !page->age) deactivate_page(page); UnlockPage(page); page_cache_release(page); --------------BAFE1D8C4B63FED01B751AB1-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/