* rw_swap_page() and swapin readahead
@ 1998-11-25 22:02 Rik van Riel
1998-11-25 22:19 ` Stephen C. Tweedie
0 siblings, 1 reply; 4+ messages in thread
From: Rik van Riel @ 1998-11-25 22:02 UTC (permalink / raw)
To: Stephen C. Tweedie; +Cc: Linux MM
Hi Stephen,
it appears that rw_swap_page() needs a small change to be
able to do asynchonous swapin.
On line 128:
if (!wait) {
set_bit(PG_free_after, &page->flags);
...
}
We probably want to loose the line with PG_free_after, even
on normal swapout (or is it already gone in 2.1.130-pre3?).
If I misunderstood the code, I'll happily learn a bit :)
cheers,
Rik -- slowly getting used to dvorak kbd layout...
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+
--
This is a majordomo managed list. To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: rw_swap_page() and swapin readahead
1998-11-25 22:02 rw_swap_page() and swapin readahead Rik van Riel
@ 1998-11-25 22:19 ` Stephen C. Tweedie
1998-11-25 22:59 ` Rik van Riel
0 siblings, 1 reply; 4+ messages in thread
From: Stephen C. Tweedie @ 1998-11-25 22:19 UTC (permalink / raw)
To: Rik van Riel; +Cc: Stephen C. Tweedie, Linux MM
Hi,
On Wed, 25 Nov 1998 23:02:30 +0100 (CET), Rik van Riel
<H.H.vanRiel@phys.uu.nl> said:
> Hi Stephen,
> it appears that rw_swap_page() needs a small change to be
> able to do asynchonous swapin.
> On line 128:
> if (!wait) {
> set_bit(PG_free_after, &page->flags);
> ...
> }
No, that's fine as it is: one of the things rw_swap_page does early on
is to increment the page's count, so that even if the caller frees the
page before the IO is complete, nobody else tries to reuse it while the
IO is still outstanding. The PG_free_after bit is there only to mark
that increment, so that the page count is decremented again
(asynchronously) once the IO is complete and no sooner.
> If I misunderstood the code, I'll happily learn a bit :)
You're welcome. :)
--Stephen
--
This is a majordomo managed list. To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: rw_swap_page() and swapin readahead
1998-11-25 22:19 ` Stephen C. Tweedie
@ 1998-11-25 22:59 ` Rik van Riel
1998-11-25 23:08 ` Stephen C. Tweedie
0 siblings, 1 reply; 4+ messages in thread
From: Rik van Riel @ 1998-11-25 22:59 UTC (permalink / raw)
To: Stephen C. Tweedie; +Cc: Linux MM
On Wed, 25 Nov 1998, Stephen C. Tweedie wrote:
> On Wed, 25 Nov 1998 23:02:30 +0100 (CET), Rik van Riel
> <H.H.vanRiel@phys.uu.nl> said:
>
> > it appears that rw_swap_page() needs a small change to be
> > able to do asynchonous swapin.
>
> > On line 128:
> > if (!wait) {
> > set_bit(PG_free_after, &page->flags);
set_bit(PG_decr_after, &page->flags);
set_bit(PG_swap_unlock_after, &page->flags);
atomic_inc(&nr_async_pages);
> > }
>
> The PG_free_after bit is there only to mark that increment, so that
> the page count is decremented again (asynchronously) once the IO is
> complete and no sooner.
Then what does the PG_decr_after do? It seems like there
are two flags to do the same thing... I'm curious :)
cheers,
Rik -- slowly getting used to dvorak kbd layout...
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+
--
This is a majordomo managed list. To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: rw_swap_page() and swapin readahead
1998-11-25 22:59 ` Rik van Riel
@ 1998-11-25 23:08 ` Stephen C. Tweedie
0 siblings, 0 replies; 4+ messages in thread
From: Stephen C. Tweedie @ 1998-11-25 23:08 UTC (permalink / raw)
To: Rik van Riel; +Cc: Stephen C. Tweedie, Linux MM
Hi,
On Wed, 25 Nov 1998 23:59:17 +0100 (CET), Rik van Riel
<H.H.vanRiel@phys.uu.nl> said:
> On Wed, 25 Nov 1998, Stephen C. Tweedie wrote:
>>
>> The PG_free_after bit is there only to mark that increment, so that
>> the page count is decremented again (asynchronously) once the IO is
>> complete and no sooner.
> Then what does the PG_decr_after do? It seems like there
> are two flags to do the same thing... I'm curious :)
It's in fs/buffer.c, after_unlock_page:
if (test_and_clear_bit(PG_decr_after, &page->flags))
atomic_dec(&nr_async_pages);
if (test_and_clear_bit(PG_swap_unlock_after, &page->flags))
swap_after_unlock_page(page->offset);
if (test_and_clear_bit(PG_free_after, &page->flags))
__free_page(page);
So PG_free_after causes us to decrement the page count after IO;
PG_decr_after decrements the global async page IO count (the one which
stops us doing runaway async swapout), andd PG_swap_unlock_after unlocks
the swap map after the IO.
--Stephen
--
This is a majordomo managed list. To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1998-11-25 23:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-25 22:02 rw_swap_page() and swapin readahead Rik van Riel
1998-11-25 22:19 ` Stephen C. Tweedie
1998-11-25 22:59 ` Rik van Riel
1998-11-25 23:08 ` Stephen C. Tweedie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox