From: Greg Kroah-Hartman Date: Tue, 18 Feb 2014 22:09:01 +0000 (-0800) Subject: 3.4-stable patches X-Git-Tag: v3.4.81~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f50ae237cb62fc292e3e7577dda177f1c742ff92;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: mm-page_alloc.c-remove-pageblock_default_order.patch mm-setup-pageblock_order-before-it-s-used-by-sparsemem.patch --- 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 index 00000000000..8572e311894 --- /dev/null +++ b/queue-3.4/mm-page_alloc.c-remove-pageblock_default_order.patch @@ -0,0 +1,98 @@ +From 955c1cd7401565671b064e499115344ec8067dfd Mon Sep 17 00:00:00 2001 +From: Andrew Morton +Date: Tue, 29 May 2012 15:06:31 -0700 +Subject: mm/page_alloc.c: remove pageblock_default_order() + +From: Andrew Morton + +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 +Cc: Mel Gorman +Cc: KAMEZAWA Hiroyuki +Cc: Tejun Heo +Cc: Minchan Kim +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +[lizf: Backported to 3.4: adjust context] +Signed-off-by: Li Zefan +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..4b2d4d0000c --- /dev/null +++ b/queue-3.4/mm-setup-pageblock_order-before-it-s-used-by-sparsemem.patch @@ -0,0 +1,94 @@ +From ca57df79d4f64e1a4886606af4289d40636189c5 Mon Sep 17 00:00:00 2001 +From: Xishi Qiu +Date: Tue, 31 Jul 2012 16:43:19 -0700 +Subject: mm: setup pageblock_order before it's used by sparsemem + +From: Xishi Qiu + +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 +Signed-off-by: Jiang Liu +Cc: Tony Luck +Cc: Yinghai Lu +Cc: KAMEZAWA Hiroyuki +Cc: Benjamin Herrenschmidt +Cc: KOSAKI Motohiro +Cc: David Rientjes +Cc: Keping Chen +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +[lizf: Backported to 3.4: adjust context] +Signed-off-by: Li Zefan +Signed-off-by: Greg Kroah-Hartman +--- + 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) diff --git a/queue-3.4/series b/queue-3.4/series index aa5c86d575b..ede120bcd9c 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -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