linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] vmscan: initialize sc->nr_reclaimed in do_try_to_free_pages()
@ 2009-02-09 22:24 Johannes Weiner
  2009-02-10 10:47 ` MinChan Kim
  2009-02-10 22:16 ` [RFC] vmscan: initialize sc->nr_reclaimed in do_try_to_free_pages() Andrew Morton
  0 siblings, 2 replies; 22+ messages in thread
From: Johannes Weiner @ 2009-02-09 22:24 UTC (permalink / raw)
  To: Rik van Riel
  Cc: William Lee Irwin III, KOSAKI Motohiro, Andrew Morton,
	linux-kernel, linux-mm

Commit a79311c14eae4bb946a97af25f3e1b17d625985d "vmscan: bail out of
direct reclaim after swap_cluster_max pages" moved the nr_reclaimed
counter into the scan control to accumulate the number of all
reclaimed pages in one direct reclaim invocation.

The commit missed to actually adjust do_try_to_free_pages() which now
does not initialize sc.nr_reclaimed and makes shrink_zone() make
assumptions on whether to bail out of the reclaim cycle based on an
uninitialized value.

Fix it up by initializing the counter to zero before entering the
priority loop.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/vmscan.c |    1 +
 1 file changed, 1 insertion(+)

The comment of the .nr_reclaimed field says it accumulates the reclaim
counter over ONE shrink_zones() call.  This means, we should break out
if ONE shrink_zones() call alone does more than swap_cluster_max.

OTOH, the patch title suggests that we break out if ALL shrink_zones()
calls in the priority loop have reclaimed that much.  I.e.
accumulating the reclaimed number over the prio loop, not just over
one zones iteration.

>From the patch description I couldn't really make sure what the
intended behaviour was.

So, should the sc.nr_reclaimed be reset before the prio loop or in
each iteration of the prio loop?

Either this patch is wrong or the comment above .nr_reclaimed is.

And why didn't this have any observable effects?  Do I miss something
really obvious here?

--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1618,6 +1618,7 @@ static unsigned long do_try_to_free_page
 		}
 	}
 
+	sc->nr_reclaimed = 0;
 	for (priority = DEF_PRIORITY; priority >= 0; priority--) {
 		sc->nr_scanned = 0;
 		if (!priority)

--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2009-02-11 13:03 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-09 22:24 [RFC] vmscan: initialize sc->nr_reclaimed in do_try_to_free_pages() Johannes Weiner
2009-02-10 10:47 ` MinChan Kim
2009-02-10 11:43   ` KOSAKI Motohiro
2009-02-10 12:03     ` MinChan Kim
2009-02-10 12:06       ` KOSAKI Motohiro
2009-02-10 12:31         ` MinChan Kim
2009-02-10 12:35           ` KOSAKI Motohiro
2009-02-10 12:40             ` MinChan Kim
2009-02-10 12:58               ` [PATCH] vmscan: initialize sc->nr_reclaimed properly take2 KOSAKI Motohiro
2009-02-10 13:00                 ` [PATCH] shrink_all_memory() use sc.nr_reclaimed KOSAKI Motohiro
2009-02-10 16:20                   ` Johannes Weiner
2009-02-10 20:41                     ` KOSAKI Motohiro
2009-02-11  0:37                       ` MinChan Kim
2009-02-11 11:50                         ` KOSAKI Motohiro
2009-02-11 12:43                           ` MinChan Kim
2009-02-11 12:58                             ` KOSAKI Motohiro
2009-02-11 13:03                               ` KOSAKI Motohiro
2009-02-10 16:09                 ` [PATCH] vmscan: initialize sc->nr_reclaimed properly take2 Johannes Weiner
2009-02-10 22:06                 ` Andrew Morton
2009-02-10 22:15                   ` Johannes Weiner
2009-02-11 10:52                   ` KOSAKI Motohiro
2009-02-10 22:16 ` [RFC] vmscan: initialize sc->nr_reclaimed in do_try_to_free_pages() Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).