From: Richard Jerrell <jerrell@missioncriticallinux.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] swap_state.c thinko
Date: Thu, 5 Apr 2001 17:39:26 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.21.0104051737480.12558-100000@jerrell.lowell.mclinux.com> (raw)
In-Reply-To: <Pine.LNX.4.21.0104051758360.1715-100000@localhost.localdomain>
> I agree that PageSwapCache(page) needs to be retested when(if) the
> page lock is acquired, but isn't it best to check PageSwapCache(page)
> first as at present - won't it very often fail? won't the overhead of
> TryLocking and Unlocking every page slow down a hot path?
Yes and no. It's only a couple of bit operations, so it's probably a
pretty negligable slow-down. But, yes it will quite often fail especially
in low memory usage situations where there isn't much swapping going
on. Adding a second test after the lock would slow down the infrequent
case and make it much more like the way lookup_swap_cache works.
> And isn't this free_page_and_swap_cache(), precisely the area that's
> currently subject to debate and patches, because swap pages are not
> getting freed soon enough?
What I think you are talking about are three seperate problems, somewhat
related.
1) swap cache pages aren't counted in vm_enough_memory as free, meaning
that you can fail when trying to allocate memory merely because a lot of
pages have already been swapped out but not yet reclaimed or possibly even
laundered. Because these pages are already in the swap cache, we know
that they can be freed if the normal path of kswapd is followed.
2) we waste time by laundering swap cache pages that are no longer being
referenced by either ptes or indirectly through the swap cell references.
Problem 1 is what is causing quite a few people to fail prematurely when
trying to allocate memory. Problem 2 is just wasting our time. Combined,
however, the two problems have dead swap cache pages eating up swap cells,
memory, and time.
> problem to be solved; but I'd rather _imagined_ it was that the page
> would here be on an LRU list, raising its count and causing the
> is_page_shared(page) test to succeed despite not really shared.
is_page_shared is expecting that someone has one of the references to the
page and is trying to determine whether or not other people are interested
in it. Being on the LRU isn't necessarily going to have the page's count
bumped by one. As a matter of practice, though, the pages on the LRU are
all in the swap cache which by way of having the page referenced by the
swap cell will bump the count by one. All this is not really part of the
problem. The problem is just that 1) swap cache pages are freeable and
2) we didn't check to make sure anyone wanted that page before writing it
to disk.
Rich
--
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 21:39 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
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 [this message]
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=Pine.LNX.4.21.0104051737480.12558-100000@jerrell.lowell.mclinux.com \
--to=jerrell@missioncriticallinux.com \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
/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