mm, hugetlb: fix and clean-up node iteration code to alloc or free
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>
Wed, 11 Sep 2013 21:21:00 +0000 (14:21 -0700)
committerMark Brown <broonie@linaro.org>
Thu, 12 Jun 2014 15:11:20 +0000 (16:11 +0100)
commitcf864eb24951e8aef8747afb8ca5a5a4615e2c69
tree13f154488e348f5efb3e8a7ad8be78bff2c40036
parent47606bdea5924196b6b8d00599f4802ab4e6dc10
mm, hugetlb: fix and clean-up node iteration code to alloc or free

Current node iteration code have a minor problem which do one more node
rotation if we can't succeed to allocate.  For example, if we start to
allocate at node 0, we stop to iterate at node 0.  Then we start to
allocate at node 1 for next allocation.

I introduce new macros "for_each_node_mask_to_[alloc|free]" and fix and
clean-up node iteration code to alloc or free.  This makes code more
understandable.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Hillf Danton <dhillf@gmail.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit b2261026825ed34066b24069359d118098bb1876)
Signed-off-by: Mark Brown <broonie@linaro.org>
mm/hugetlb.c