Re: updated patch for 2.1.103 swap code

Bill Hawes (whawes@star.net)
Tue, 02 Jun 1998 21:10:18 -0400


Stephen C. Tweedie wrote:

> There's at least one problem with this patch: it does not call a
> wait_on_page() if read_swap_cache_async() is called with wait!=0.
> That may cause memory corruption if two pageins from separate
> processes collide on the same page.

Hi Stephen,

No, that's not correct -- the second call to lookup_swap_cache will do a
wait_on_page if necessary, just as the original code did. The difference
is that the patch calls swap_duplicate() and allocates a new page
instead of immediately calling wait_on_page, and then the second lookup
will preserve the original semantics.

Effectively this keeps the fast path fast (assuming there's a reasonable
probability of finding a page in the swap cache), while also protecting
against the race with having the swap entry become unused if there's a
stall.

Regards,
Bill

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu