From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 23 Apr 2001 17:53:18 +0100 From: Jonathan Morton Subject: Re: [patch] swap-speedup-2.4.3-A1, massive swapping speedup Sender: owner-linux-mm@kvack.org Return-Path: To: Rik van Riel , Ingo Molnar Cc: Linus Torvalds , Alan Cox , Linux Kernel List , linux-mm@kvack.org, Marcelo Tosatti , Szabolcs Szakacsits List-ID: >There seems to be one more reason, take a look at the function >read_swap_cache_async() in swap_state.c, around line 240: > > /* > * Add it to the swap cache and read its contents. > */ > lock_page(new_page); > add_to_swap_cache(new_page, entry); > rw_swap_page(READ, new_page, wait); > return new_page; > >Here we add an "empty" page to the swap cache and use the >page lock to protect people from reading this non-up-to-date >page. How about reversing the order of the calls - ie. add the page to the cache only when it's been filled? That would fix the race. -------------------------------------------------------------- from: Jonathan "Chromatix" Morton mail: chromi@cyberspace.org (not for attachments) big-mail: chromatix@penguinpowered.com uni-mail: j.d.morton@lancaster.ac.uk The key to knowledge is not to rely on people to teach you it. Get VNC Server for Macintosh from http://www.chromatix.uklinux.net/vnc/ -----BEGIN GEEK CODE BLOCK----- Version 3.12 GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r++ y+(*) -----END GEEK CODE BLOCK----- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/