From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 30 Jul 2001 18:44:01 -0700 (PDT) From: Linus Torvalds Subject: Re: strange locking __find_get_swapcache_page() In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Rik van Riel Cc: linux-mm@kvack.org, Andrea Arcangeli , Andrew Morton , Marcelo Tosatti List-ID: On Mon, 30 Jul 2001, Rik van Riel wrote: > > I've encountered a suspicious piece of code in filemap.c: > > struct page * __find_get_swapcache_page( ... ) Hmm. I thin the whole PageSwapCache() test is bogus - if we found it on the swapper_space address space, then the page had better be a swap-cache page, and testing for it explicitly is silly. Also, it appears that the only caller of this is find_get_swapcache_page(), which in itself really doesn't even care: it just uses the lookup as a boolen on whether to add a new page to the swap cache, and does even _that_ completely wrong. There's a big race there, see if you can spot it. The fix, I suspect, is to pretty much get rid of the code altogether, and make it use add_to_page_cache_unique() or whatever it is called that gets the duplicate check _right_. Linus -- 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-mm.org/