The patch titled kswapd: assign new_order and new_classzone_idx after wakeup in sleeping has been added to the -mm tree. Its filename is kswapd-assign-new_order-and-new_classzone_idx-after-wakeup-in-sleeping.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: kswapd: assign new_order and new_classzone_idx after wakeup in sleeping From: "Alex,Shi" <alex.shi@xxxxxxxxx> There 2 places to read pgdat in kswapd. One is return from a successful balance, another is waked up from kswapd sleeping. The new_order and new_classzone_idx represent the balance input order and classzone_idx. But current new_order and new_classzone_idx are not assigned after kswapd_try_to_sleep(), that will cause a bug in the following scenario. 1: after a successful balance, kswapd goes to sleep, and new_order = 0; new_classzone_idx = __MAX_NR_ZONES - 1; 2: kswapd waked up with order = 3 and classzone_idx = ZONE_NORMAL 3: in the balance_pgdat() running, a new balance wakeup happened with order = 5, and classzone_idx = ZONE_NORMAL 4: the first wakeup(order = 3) finished successufly, return order = 3 but, the new_order is still 0, so, this balancing will be treated as a failed balance. And then the second tighter balancing will be missed. So, to avoid the above problem, the new_order and new_classzone_idx need to be assigned for later successful comparison. Signed-off-by: Alex Shi <alex.shi@xxxxxxxxx> Acked-by: Mel Gorman <mgorman@xxxxxxx> Reviewed-by: Minchan Kim <minchan.kim@xxxxxxxxx> Tested-by: Pádraig Brady <P@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 2 ++ 1 file changed, 2 insertions(+) diff -puN mm/vmscan.c~kswapd-assign-new_order-and-new_classzone_idx-after-wakeup-in-sleeping mm/vmscan.c --- a/mm/vmscan.c~kswapd-assign-new_order-and-new_classzone_idx-after-wakeup-in-sleeping +++ a/mm/vmscan.c @@ -2883,6 +2883,8 @@ static int kswapd(void *p) balanced_classzone_idx); order = pgdat->kswapd_max_order; classzone_idx = pgdat->classzone_idx; + new_order = order; + new_classzone_idx = classzone_idx; pgdat->kswapd_max_order = 0; pgdat->classzone_idx = pgdat->nr_zones - 1; } _ Patches currently in -mm which might be from alex.shi@xxxxxxxxx are linux-next.patch kswapd-avoid-unnecessary-rebalance-after-an-unsuccessful-balancing.patch kswapd-assign-new_order-and-new_classzone_idx-after-wakeup-in-sleeping.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html