The patch titled Subject: mm: fix free page check in zone_watermark_ok() has been added to the -mm tree. Its filename is mm-bug-fix-free-page-check-in-zone_watermark_ok.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 *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Minchan Kim <minchan@xxxxxxxxxx> Subject: mm: fix free page check in zone_watermark_ok() In __zone_watermark_ok(), free and min are signed long type while z->lowmem_reserve[classzone_idx] is unsigned long type. So comparision of them could be wrong due to type conversion to unsigned although free_pages is minus value. It could return true instead of false in case of order-0 check so that kswapd could sleep forever. It means livelock because direct reclaimer loops forever until kswapd set zone->all_unreclaimable. Aaditya reported this problem when he test my hotplug patch. Reported-off-by: Aaditya Kumar <aaditya.kumar@xxxxxxxxxxx> Tested-by: Aaditya Kumar <aaditya.kumar@xxxxxxxxxxx> Signed-off-by: Aaditya Kumar <aaditya.kumar@xxxxxxxxxxx> Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Reviewed-by: Michal Hocko <mhocko@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN mm/page_alloc.c~mm-bug-fix-free-page-check-in-zone_watermark_ok mm/page_alloc.c --- a/mm/page_alloc.c~mm-bug-fix-free-page-check-in-zone_watermark_ok +++ a/mm/page_alloc.c @@ -1594,6 +1594,7 @@ static bool __zone_watermark_ok(struct z { /* free_pages my go negative - that's OK */ long min = mark; + long lowmem_reserve = z->lowmem_reserve[classzone_idx]; int o; free_pages -= (1 << order) - 1; @@ -1602,7 +1603,7 @@ static bool __zone_watermark_ok(struct z if (alloc_flags & ALLOC_HARDER) min -= min / 4; - if (free_pages <= min + z->lowmem_reserve[classzone_idx]) + if (free_pages <= min + lowmem_reserve) return false; for (o = 0; o < order; o++) { /* At the next order, this order's pages become unavailable */ _ Subject: Subject: mm: fix free page check in zone_watermark_ok() Patches currently in -mm which might be from minchan@xxxxxxxxxx are origin.patch linux-next.patch swap-allow-swap-readahead-to-be-merged.patch documentation-update-how-page-cluster-affects-swap-i-o.patch mm-compaction-cleanup-on-compaction_deferred.patch memcg-prevent-oom-with-too-many-dirty-pages.patch mm-clear-pages_scanned-only-if-draining-a-pcp-adds-pages-to-the-buddy-allocator-again.patch mm-do-not-use-page_count-without-a-page-pin.patch mm-clean-up-__count_immobile_pages.patch vmscan-remove-obsolete-shrink_control-comment.patch mm-hotplug-correctly-setup-fallback-zonelists-when-creating-new-pgdat.patch mm-hotplug-correctly-add-new-zone-to-all-other-nodes-zone-lists.patch mm-hotplug-free-zone-pageset-when-a-zone-becomes-empty.patch mm-hotplug-mark-memory-hotplug-code-in-page_allocc-as-__meminit.patch mm-factor-out-memory-isolate-functions.patch mm-bug-fix-free-page-check-in-zone_watermark_ok.patch memory-hotplug-fix-kswapd-looping-forever-problem.patch memory-hotplug-fix-kswapd-looping-forever-problem-fix.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