Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 23 Apr 2001 12:54:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 23 Apr 2001 12:54:23 -0400 Received: from turnover.lancs.ac.uk ([148.88.17.220]:17405 "EHLO helium.chromatix.org.uk") by vger.kernel.org with ESMTP id ; Mon, 23 Apr 2001 12:54:15 -0400 Message-Id: In-Reply-To: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 23 Apr 2001 17:53:18 +0100 To: Rik van Riel , Ingo Molnar From: Jonathan Morton Subject: Re: [patch] swap-speedup-2.4.3-A1, massive swapping speedup Cc: Linus Torvalds , Alan Cox , Linux Kernel List , linux-mm@kvack.org, Marcelo Tosatti , Szabolcs Szakacsits Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org >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 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/