]> Git Repo - linux.git/commit
mm: fix free page check in zone_watermark_ok()
authorMinchan Kim <[email protected]>
Tue, 31 Jul 2012 23:43:53 +0000 (16:43 -0700)
committerLinus Torvalds <[email protected]>
Wed, 1 Aug 2012 01:42:45 +0000 (18:42 -0700)
commit2cfed0752808625d30aca7fc9f383af386fd8a13
tree5e92da86e42e55b253cc04e10545e05b6b472542
parentee6f509c3274014d1f52e7a7a10aee9f85393c5e
mm: fix free page check in zone_watermark_ok()

__zone_watermark_ok currently compares free_pages which is a signed type
with z->lowmem_reserve[classzone_idx] which is unsigned which might lead
to sign overflow if free_pages doesn't satisfy the given order (or it came
as negative already) and then we rely on the following order loop to fix
it (which doesn't work for order-0).  Let's fix the type conversion and do
not rely on the given value of free_pages or follow up fixups.

This patch fixes it because "memory-hotplug: fix kswapd looping forever
problem" depends on this.

As benefit of this patch, it doesn't rely on the loop to exit
__zone_watermark_ok in case of high order check and make the first test
effective.(ie, if (free_pages <= min + lowmem_reserve))

Aaditya reported this problem when he test my hotplug patch.

Reported-off-by: Aaditya Kumar <[email protected]>
Tested-by: Aaditya Kumar <[email protected]>
Signed-off-by: Aaditya Kumar <[email protected]>
Signed-off-by: Minchan Kim <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Mel Gorman <[email protected]>
Reviewed-by: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c
This page took 0.042724 seconds and 4 git commands to generate.