]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.27.36/hugetlb-restore-interleaving-of-bootmem-huge-pages.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 2.6.27.36 / hugetlb-restore-interleaving-of-bootmem-huge-pages.patch
CommitLineData
14f1017b
GKH
1From akpm@linux-foundation.org Thu Oct 1 15:24:58 2009
2From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
3Date: Mon, 21 Sep 2009 17:01:04 -0700
4Subject: hugetlb: restore interleaving of bootmem huge pages (2.6.31)
5To: torvalds@linux-foundation.org
6Cc: Lee.Schermerhorn@hp.com, lee.schermerhorn@hp.com, ak@linux.intel.com, eric.whitney@hp.com, mel@csn.ul.ie, rientjes@google.com, agl@us.ibm.com, apw@canonical.com, akpm@linux-foundation.org, stable@kernel.org
7Message-ID: <200909220001.n8M014vN026389@imap1.linux-foundation.org>
8
9
10From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
11
12Not upstream as it is fixed differently in .32
13
14I noticed that alloc_bootmem_huge_page() will only advance to the next
15node on failure to allocate a huge page. I asked about this on linux-mm
16and linux-numa, cc'ing the usual huge page suspects. Mel Gorman
17responded:
18
19 I strongly suspect that the same node being used until allocation
20 failure instead of round-robin is an oversight and not deliberate
21 at all. It appears to be a side-effect of a fix made way back in
22 commit 63b4613c3f0d4b724ba259dc6c201bb68b884e1a ["hugetlb: fix
23 hugepage allocation with memoryless nodes"]. Prior to that patch
24 it looked like allocations would always round-robin even when
25 allocation was successful.
26
27Andy Whitcroft countered that the existing behavior looked like Andi
28Kleen's original implementation and suggested that we ask him. We did and
29Andy replied that his intention was to interleave the allocations. So,
30...
31
32This patch moves the advance of the hstate next node from which to
33allocate up before the test for success of the attempted allocation. This
34will unconditionally advance the next node from which to alloc,
35interleaving successful allocations over the nodes with sufficient
36contiguous memory, and skipping over nodes that fail the huge page
37allocation attempt.
38
39Note that alloc_bootmem_huge_page() will only be called for huge pages of
40order > MAX_ORDER.
41
42Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
43Reviewed-by: Andi Kleen <ak@linux.intel.com>
44Cc: Mel Gorman <mel@csn.ul.ie>
45Cc: David Rientjes <rientjes@google.com>
46Cc: Adam Litke <agl@us.ibm.com>
47Cc: Andy Whitcroft <apw@canonical.com>
48Cc: Eric Whitney <eric.whitney@hp.com>
49Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
50Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
51
52---
53 mm/hugetlb.c | 2 +-
54 1 file changed, 1 insertion(+), 1 deletion(-)
55
56--- a/mm/hugetlb.c
57+++ b/mm/hugetlb.c
58@@ -983,6 +983,7 @@ __attribute__((weak)) int alloc_bootmem_
59 NODE_DATA(h->hugetlb_next_nid),
60 huge_page_size(h), huge_page_size(h), 0);
61
62+ hstate_next_node(h);
63 if (addr) {
64 /*
65 * Use the beginning of the huge page to store the
66@@ -993,7 +994,6 @@ __attribute__((weak)) int alloc_bootmem_
67 if (m)
68 goto found;
69 }
70- hstate_next_node(h);
71 nr_nodes--;
72 }
73 return 0;