Skip to contentSkip to conversation

do_swap_page() in -pre4

DISCUSSION Linus Torvalds 1 participant 1 message Oct 30, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · Andrew Morton
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Andrew Morton

That UnlockPage() looks wrong to me?

You're right. I'll fix it and make a pre5, it's obviously left-overs from before..

pre5 fixed (along with some other things, like remobing from the LRU list in all cases where needed..)

Quoted 4 lines

OK. Could you please add mm->page_table_lock to this comment:

+ *
+ * Ordering:

       mm->page_table_lock ->
Quoted 1 line

+ * swap_lock ->

	    swap_device_lock() ->
Quoted 2 lines

+ * pagemap_lru_lock ->
+ * pagecache_lock

is what it should be. If that doesn't look right, holler.

I don't think any other locking really changed, except the LRU and the pagecache lock used to be the other way around.

Oh, the thing that _did_ change was that getting the page lock used to also freeze the swap_map count for that page. Which meant much too much locking of pages on swapin (which in turn meant that you couldn't just re-attach the page while it was being written out).

pre5 makes the new rules clearer, I think (ie we check the swap count under the swap lock, and we check the page count under the pagecache lock, so there should be no "subtle" rules wrt the page lock at all. The page lock has no bearing on the swap count at all).

I've tested pre5 by running X and konqueror in 40MB of RAM, and I tested pre4 by swapping heavily in 2GB or ram (which only goes to show you how forgiving 2G is even if you have almost 3BG in swap - the UnlockPage and a few other things were very clear in 40MB and never showed up with tons of memory).

It behaves well here, although in the low-memory tests I think there I've found what appears to be a KDE process startup race condition (ie KDE is not happy about swapping heavily and starting new processes - looks like the communication setup is racy or something).

Testers appreciated,

Linus