]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2014 22:09:01 +0000 (14:09 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2014 22:09:01 +0000 (14:09 -0800)
added patches:
mm-page_alloc.c-remove-pageblock_default_order.patch
mm-setup-pageblock_order-before-it-s-used-by-sparsemem.patch

queue-3.4/mm-page_alloc.c-remove-pageblock_default_order.patch [new file with mode: 0644]
queue-3.4/mm-setup-pageblock_order-before-it-s-used-by-sparsemem.patch [new file with mode: 0644]
queue-3.4/series

diff --git a/queue-3.4/mm-page_alloc.c-remove-pageblock_default_order.patch b/queue-3.4/mm-page_alloc.c-remove-pageblock_default_order.patch
new file mode 100644 (file)
index 0000000..8572e31
--- /dev/null
@@ -0,0 +1,98 @@
+From 955c1cd7401565671b064e499115344ec8067dfd Mon Sep 17 00:00:00 2001
+From: Andrew Morton <akpm@linux-foundation.org>
+Date: Tue, 29 May 2012 15:06:31 -0700
+Subject: mm/page_alloc.c: remove pageblock_default_order()
+
+From: Andrew Morton <akpm@linux-foundation.org>
+
+commit 955c1cd7401565671b064e499115344ec8067dfd upstream.
+
+This has always been broken: one version takes an unsigned int and the
+other version takes no arguments.  This bug was hidden because one
+version of set_pageblock_order() was a macro which doesn't evaluate its
+argument.
+
+Simplify it all and remove pageblock_default_order() altogether.
+
+Reported-by: rajman mekaco <rajman.mekaco@gmail.com>
+Cc: Mel Gorman <mel@csn.ul.ie>
+Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
+Cc: Tejun Heo <tj@kernel.org>
+Cc: Minchan Kim <minchan.kim@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+[lizf: Backported to 3.4: adjust context]
+Signed-off-by: Li Zefan <lizefan@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/page_alloc.c |   33 +++++++++++++++------------------
+ 1 file changed, 15 insertions(+), 18 deletions(-)
+
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -4254,25 +4254,24 @@ static inline void setup_usemap(struct p
+ #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
+-/* Return a sensible default order for the pageblock size. */
+-static inline int pageblock_default_order(void)
+-{
+-      if (HPAGE_SHIFT > PAGE_SHIFT)
+-              return HUGETLB_PAGE_ORDER;
+-
+-      return MAX_ORDER-1;
+-}
+-
+ /* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */
+-static inline void __init set_pageblock_order(unsigned int order)
++static inline void __init set_pageblock_order(void)
+ {
++      unsigned int order;
++
+       /* Check that pageblock_nr_pages has not already been setup */
+       if (pageblock_order)
+               return;
++      if (HPAGE_SHIFT > PAGE_SHIFT)
++              order = HUGETLB_PAGE_ORDER;
++      else
++              order = MAX_ORDER - 1;
++
+       /*
+        * Assume the largest contiguous order of interest is a huge page.
+-       * This value may be variable depending on boot parameters on IA64
++       * This value may be variable depending on boot parameters on IA64 and
++       * powerpc.
+        */
+       pageblock_order = order;
+ }
+@@ -4280,15 +4279,13 @@ static inline void __init set_pageblock_
+ /*
+  * When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not set, set_pageblock_order()
+- * and pageblock_default_order() are unused as pageblock_order is set
+- * at compile-time. See include/linux/pageblock-flags.h for the values of
+- * pageblock_order based on the kernel config
++ * is unused as pageblock_order is set at compile-time. See
++ * include/linux/pageblock-flags.h for the values of pageblock_order based on
++ * the kernel config
+  */
+-static inline int pageblock_default_order(unsigned int order)
++static inline void set_pageblock_order(void)
+ {
+-      return MAX_ORDER-1;
+ }
+-#define set_pageblock_order(x)        do {} while (0)
+ #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
+@@ -4376,7 +4373,7 @@ static void __paginginit free_area_init_
+               if (!size)
+                       continue;
+-              set_pageblock_order(pageblock_default_order());
++              set_pageblock_order();
+               setup_usemap(pgdat, zone, zone_start_pfn, size);
+               ret = init_currently_empty_zone(zone, zone_start_pfn,
+                                               size, MEMMAP_EARLY);
diff --git a/queue-3.4/mm-setup-pageblock_order-before-it-s-used-by-sparsemem.patch b/queue-3.4/mm-setup-pageblock_order-before-it-s-used-by-sparsemem.patch
new file mode 100644 (file)
index 0000000..4b2d4d0
--- /dev/null
@@ -0,0 +1,94 @@
+From ca57df79d4f64e1a4886606af4289d40636189c5 Mon Sep 17 00:00:00 2001
+From: Xishi Qiu <qiuxishi@huawei.com>
+Date: Tue, 31 Jul 2012 16:43:19 -0700
+Subject: mm: setup pageblock_order before it's used by sparsemem
+
+From: Xishi Qiu <qiuxishi@huawei.com>
+
+commit ca57df79d4f64e1a4886606af4289d40636189c5 upstream.
+
+On architectures with CONFIG_HUGETLB_PAGE_SIZE_VARIABLE set, such as
+Itanium, pageblock_order is a variable with default value of 0.  It's set
+to the right value by set_pageblock_order() in function
+free_area_init_core().
+
+But pageblock_order may be used by sparse_init() before free_area_init_core()
+is called along path:
+sparse_init()
+    ->sparse_early_usemaps_alloc_node()
+       ->usemap_size()
+           ->SECTION_BLOCKFLAGS_BITS
+               ->((1UL << (PFN_SECTION_SHIFT - pageblock_order)) *
+NR_PAGEBLOCK_BITS)
+
+The uninitialized pageblock_size will cause memory wasting because
+usemap_size() returns a much bigger value then it's really needed.
+
+For example, on an Itanium platform,
+sparse_init() pageblock_order=0 usemap_size=24576
+free_area_init_core() before pageblock_order=0, usemap_size=24576
+free_area_init_core() after pageblock_order=12, usemap_size=8
+
+That means 24K memory has been wasted for each section, so fix it by calling
+set_pageblock_order() from sparse_init().
+
+Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
+Signed-off-by: Jiang Liu <liuj97@gmail.com>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: Yinghai Lu <yinghai@kernel.org>
+Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
+Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Cc: David Rientjes <rientjes@google.com>
+Cc: Keping Chen <chenkeping@huawei.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+[lizf: Backported to 3.4: adjust context]
+Signed-off-by: Li Zefan <lizefan@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/internal.h   |    2 ++
+ mm/page_alloc.c |    4 ++--
+ mm/sparse.c     |    3 +++
+ 3 files changed, 7 insertions(+), 2 deletions(-)
+
+--- a/mm/internal.h
++++ b/mm/internal.h
+@@ -309,3 +309,5 @@ extern u64 hwpoison_filter_flags_mask;
+ extern u64 hwpoison_filter_flags_value;
+ extern u64 hwpoison_filter_memcg;
+ extern u32 hwpoison_filter_enable;
++
++extern void set_pageblock_order(void);
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -4255,7 +4255,7 @@ static inline void setup_usemap(struct p
+ #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
+ /* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */
+-static inline void __init set_pageblock_order(void)
++void __init set_pageblock_order(void)
+ {
+       unsigned int order;
+@@ -4283,7 +4283,7 @@ static inline void __init set_pageblock_
+  * include/linux/pageblock-flags.h for the values of pageblock_order based on
+  * the kernel config
+  */
+-static inline void set_pageblock_order(void)
++void __init set_pageblock_order(void)
+ {
+ }
+--- a/mm/sparse.c
++++ b/mm/sparse.c
+@@ -486,6 +486,9 @@ void __init sparse_init(void)
+       struct page **map_map;
+ #endif
++      /* Setup pageblock_order for HUGETLB_PAGE_SIZE_VARIABLE */
++      set_pageblock_order();
++
+       /*
+        * map is using big page (aka 2M in x86 64 bit)
+        * usemap is less one page (aka 24 bytes)
index aa5c86d575b1d124048165dac25b75619e597ef2..ede120bcd9c1f84b1a8cd9eda3bfe98c93106157 100644 (file)
@@ -5,3 +5,5 @@ x86-hweight-fix-bug-when-booting-with-config_gcov_profile_all-y.patch
 printk-fix-scheduling-while-atomic-problem-in-console_cpu_notify.patch
 ext4-protect-group-inode-free-counting-with-group-lock.patch
 drm-i915-kick-any-firmware-framebuffers-before-claiming-the-gtt.patch
+mm-page_alloc.c-remove-pageblock_default_order.patch
+mm-setup-pageblock_order-before-it-s-used-by-sparsemem.patch