From: Andrea Arcangeli <andrea@suse.de>
To: Ben LaHaise <bcrl@redhat.com>
Cc: Rik van Riel <riel@conectiva.com.br>,
arjanv@redhat.com, alan@redhat.com, torvalds@transmeta.com,
linux-mm@kvack.org
Subject: Re: [PATCH] swap_state.c thinko
Date: Fri, 6 Apr 2001 01:40:23 +0200 [thread overview]
Message-ID: <20010406014023.B1330@athlon.random> (raw)
In-Reply-To: <Pine.LNX.4.30.0104051310470.1767-100000@today.toronto.redhat.com>; from bcrl@redhat.com on Thu, Apr 05, 2001 at 01:11:30PM -0400
On Thu, Apr 05, 2001 at 01:11:30PM -0400, Ben LaHaise wrote:
> diff -ur v2.4.3/mm/swap_state.c work-2.4.3/mm/swap_state.c
> --- v2.4.3/mm/swap_state.c Fri Dec 29 18:04:27 2000
> +++ work-2.4.3/mm/swap_state.c Thu Apr 5 13:10:27 2001
> @@ -140,10 +140,9 @@
> /*
> * If we are the only user, then try to free up the swap cache.
> */
> - if (PageSwapCache(page) && !TryLockPage(page)) {
> - if (!is_page_shared(page)) {
> + if (!TryLockPage(page)) {
> + if (PageSwapCache(page) && !is_page_shared(page))
> delete_from_swap_cache_nolock(page);
> - }
> UnlockPage(page);
> }
> page_cache_release(page);
swap cache pages should not be freeable by the memory balancing code because if
you're running at that point the reference count of the swap cache has to be > 1.
swapoff will grab the pagetable spinlock before dropping the swap cache
so it shouldn't run under such code either (and swapoff was used to
have other window for races anyways).
could you elaborate what can eat the swap cache from under you if you
don't first lock down the page before checking the swapcache bit? I thought
the reason for grabbing the lock there is just to do the trylock instead
of lock_page(): we can't use the delete_from_swap_cache that could otherwise
sleep if the page was for example locked down by the memory balancing code
while we were running there (if we fail we simply left some more spurious swap
cache).
Andrea
--
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/
next prev parent reply other threads:[~2001-04-05 23:40 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-05 15:56 Ben LaHaise
2001-04-05 16:05 ` Rik van Riel
2001-04-05 17:11 ` Ben LaHaise
2001-04-05 23:40 ` Andrea Arcangeli [this message]
2001-04-06 0:32 ` Linus Torvalds
2001-04-06 16:31 ` Hugh Dickins
2001-04-06 17:21 ` Linus Torvalds
2001-04-06 18:23 ` Hugh Dickins
2001-04-06 18:57 ` Linus Torvalds
2001-04-06 19:06 ` Rik van Riel
2001-04-06 18:47 ` Andrea Arcangeli
2001-04-06 18:37 ` Hugh Dickins
2001-04-06 19:09 ` Andrea Arcangeli
2001-04-06 18:53 ` Hugh Dickins
2001-04-06 19:14 ` Andrea Arcangeli
2001-04-06 19:03 ` Hugh Dickins
2001-04-06 20:03 ` Andrea Arcangeli
2001-04-06 19:12 ` Richard Jerrell
2001-04-06 19:52 ` Linus Torvalds
2001-04-06 20:22 ` Andrea Arcangeli
2001-04-06 21:04 ` Rik van Riel
2001-04-07 1:27 ` Andrea Arcangeli
2001-04-09 18:16 ` Alan Cox
2001-04-09 18:45 ` Andrea Arcangeli
2001-04-09 20:32 ` Linus Torvalds
2001-04-09 20:54 ` David L. Parsley
2001-04-10 21:07 ` James Antill
2001-04-10 22:20 ` Jeff Garzik
2001-04-06 20:48 ` Hugh Dickins
2001-04-05 17:21 ` Hugh Dickins
2001-04-05 21:39 ` Richard Jerrell
2001-04-06 20:20 Bulent Abali
2001-04-06 20:33 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010406014023.B1330@athlon.random \
--to=andrea@suse.de \
--cc=alan@redhat.com \
--cc=arjanv@redhat.com \
--cc=bcrl@redhat.com \
--cc=linux-mm@kvack.org \
--cc=riel@conectiva.com.br \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox