Skip to contentSkip to conversation

mm/vmscan.c:shrink_list(): check PageSwapCache() after add_to_swap()

PATCH In review Nikita Danilov 4 participants 8 messages Jan 28, 2004 – Feb 4, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/vmscan.c:shrink_list(): check PageSwapCache() after add_to_swap()

Hello,

shrink_list() checks PageSwapCache() before calling add_to_swap(), this means that anonymous page that is going to be added to the swap right now these checks return false and:

(*) it will be unaccounted for in nr_mapped, and

(*) it won't be written to the swap if gfp_flags include __GFP_IO but

     not __GFP_FS.

(Both will happen only on the next round of scanning.)

Patch below just moves may_enter_fs initialization down. I am not sure about (*nr_mapped) increase though.

Comments?

Nikita.

mm/vmscan.c renamed from mm/vmscan.c~check-PageSwapCache-after-add-to-swap +3 -2
diff -puN -b mm/vmscan.c~check-PageSwapCache-after-add-to-swap mm/vmscan.c
@@ -380,8 +380,6 @@ shrink_list(struct list_head *page_list,
 			(*nr_mapped)++;
 
 		BUG_ON(PageActive(page));
-		may_enter_fs = (gfp_mask & __GFP_FS) ||
-				(PageSwapCache(page) && (gfp_mask & __GFP_IO));
 
 		if (PageWriteback(page))
 			goto keep_locked;
@@ -412,6 +410,9 @@ shrink_list(struct list_head *page_list,
 		}
 #endif /* CONFIG_SWAP */
 
+		may_enter_fs = (gfp_mask & __GFP_FS) ||
+				(PageSwapCache(page) && (gfp_mask & __GFP_IO));
+
 		/*
 		 * The page is mapped into the page tables of one or more
 		 * processes. Try to unmap it here.

_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 7 lines · Nikita Danilov

Hello,

shrink_list() checks PageSwapCache() before calling add_to_swap(), this means that anonymous page that is going to be added to the swap right now these checks return false and:

Quoted 6 lines

(*) it will be unaccounted for in nr_mapped, and

(*) it won't be written to the swap if gfp_flags include __GFP_IO but

     not __GFP_FS.

(Both will happen only on the next round of scanning.)

OK. Does it make a measurable change in any benchmarks?

Quoted 2 lines

Patch below just moves may_enter_fs initialization down. I am not sure about (*nr_mapped) increase though.

nr_mapped seems OK.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw

[BENCHMARKS] 2.6 kbuild results (with add_to_swap patch)

Quoted 10 lines · Andrew Morton
Quoted 8 lines · Nikita Danilov

Hello,

shrink_list() checks PageSwapCache() before calling add_to_swap(), this means that anonymous page that is going to be added to the swap right now these checks return false and:

(*) it will be unaccounted for in nr_mapped, and

Quoted 9 lines
Quoted 5 lines

(*) it won't be written to the swap if gfp_flags include __GFP_IO but

    not __GFP_FS.

(Both will happen only on the next round of scanning.)

OK. Does it make a measurable change in any benchmarks?

Small big significantly better on kbuild when tested on top of the other two patches (dont-rotate-active-list and my mapped-fair).

With this patch as well, we are now as good or better than 2.4 on medium and heavy swapping kbuilds and much better than stock 2.6 with light swapping loads (not as good as 2.4 but close).

http://www.kerneltrap.org/~npiggin/vm/3/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

Re: [BENCHMARKS] 2.6 kbuild results (with add_to_swap patch)

Quoted 2 lines · Nick Piggin

Small big significantly better on kbuild when tested on top of the other two patches (dont-rotate-active-list and my mapped-fair).

Where can I grab those ?

Quoted 5 lines

With this patch as well, we are now as good or better than 2.4 on medium and heavy swapping kbuilds and much better than stock 2.6 with light swapping loads (not as good as 2.4 but close).

http://www.kerneltrap.org/~npiggin/vm/3/

Neat! Does it have any side effects to interactive desktop behaviour ?

Signature · 9 lines
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw

Re: [BENCHMARKS] 2.6 kbuild results (with add_to_swap patch)

Quoted 10 lines · Rik van Riel
Quoted 3 lines · Nick Piggin

Small big significantly better on kbuild when tested on top of the other two patches (dont-rotate-active-list and my mapped-fair).

Where can I grab those ?

I've put the all here for now.
They are against the latest mm with the RSS patch backed out.

http://kerneltrap.org/~npiggin/vm/

Quoted 11 lines
Quoted 6 lines

With this patch as well, we are now as good or better than 2.4 on medium and heavy swapping kbuilds and much better than stock 2.6 with light swapping loads (not as good as 2.4 but close).

http://www.kerneltrap.org/~npiggin/vm/3/

Neat! Does it have any side effects to interactive desktop behaviour ?

To be honest I haven't tried them on my desktop. I would guess they should be fine.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw

Re: [BENCHMARKS] 2.6 kbuild results (with add_to_swap patch)

Quoted 8 lines · Andrew Morton
Quoted 2 lines · Nick Piggin

They are against the latest mm with the RSS patch backed out.

Is the rss patch in mm2 still misbehaving?

I haven't had a look yet Andrew, I'll give it a try soon. Sorry, I actually meant 2.6.2-rc2-mm1.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw

Re: [BENCHMARKS] 2.6 kbuild results (with add_to_swap patch)

In reply to Rik van Riel
Quoted 14 lines · Rik van Riel
Quoted 3 lines · Nick Piggin

Small big significantly better on kbuild when tested on top of the other two patches (dont-rotate-active-list and my mapped-fair).

Where can I grab those ?

Quoted 4 lines

With this patch as well, we are now as good or better than 2.4 on medium and heavy swapping kbuilds and much better than stock 2.6 with light swapping loads (not as good as 2.4 but close).

Quoted 7 lines
Quoted 2 lines

http://www.kerneltrap.org/~npiggin/vm/3/

Neat! Does it have any side effects to interactive desktop behaviour ?

Hi Rik,
I've just tried the latest patchset on my desktop system. Doing a make -j4 bzImage, hdparm -t /dev/hda in a loop, mozilla, gnome xterms etc.

Nothing bad is happening, although I'm only just touching swap.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>