Skip to contentSkip to conversation

mm, pageblock: make sure pageblock won't exceed mem_sectioin

PATCH In review Wei Yang 5 participants 18 messages Dec 5, 2018 – Dec 13, 2018

Subsystems (4)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/2 mm, pageblock: make sure pageblock won't exceed mem_sectioin

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

---
 include/linux/mmzone.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/mmzone.h +4 -0
index be126113b499..8f3ce3a0c7d6 100644
@@ -1084,6 +1084,10 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn)
 #error Allocator MAX_ORDER exceeds SECTION_SIZE
 #endif
 
+#if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
+#error Allocator pageblock_order exceeds SECTION_SIZE
+#endif
+
 static inline unsigned long pfn_to_section_nr(unsigned long pfn)
 {
 	return pfn >> PFN_SECTION_SHIFT;
Signature · 1 line
2.15.1
author
#1 lore raw

PATCH 2/2 mm, page_alloc: cleanup usemap_size() when SPARSEMEM is not set

Two cleanups in this patch:

* since pageblock_nr_pages == (1 << pageblock_order), the roundup() and right shift pageblock_order could be replaced with DIV_ROUND_UP()
* use BITS_TO_LONGS() to get number of bytes for bitmap

This patch also fix one typo in comment.

---
 mm/page_alloc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
mm/page_alloc.c +3 -6
index 7c745c305332..baf473f80800 100644
@@ -6204,7 +6204,7 @@ static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
 /*
  * Calculate the size of the zone->blockflags rounded to an unsigned long
  * Start by making sure zonesize is a multiple of pageblock_order by rounding
- * up. Then use 1 NR_PAGEBLOCK_BITS worth of bits per pageblock, finally
+ * up. Then use 1 NR_PAGEBLOCK_BITS width of bits per pageblock, finally
  * round what is now in bits to nearest long in bits, then return it in
  * bytes.
  */
@@ -6213,12 +6213,9 @@ static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned l
 	unsigned long usemapsize;
 
 	zonesize += zone_start_pfn & (pageblock_nr_pages-1);
-	usemapsize = roundup(zonesize, pageblock_nr_pages);
-	usemapsize = usemapsize >> pageblock_order;
+	usemapsize = DIV_ROUND_UP(zonesize, pageblock_nr_pages);
 	usemapsize *= NR_PAGEBLOCK_BITS;
-	usemapsize = roundup(usemapsize, 8 * sizeof(unsigned long));
-
-	return usemapsize / 8;
+	return BITS_TO_LONGS(usemapsize) * sizeof(unsigned long);
 }
 
 static void __ref setup_usemap(struct pglist_data *pgdat,
Signature · 1 line
2.15.1
author
#2 lore raw

Re: [PATCH 2/2] mm, page_alloc: cleanup usemap_size() when SPARSEMEM is not set

Quoted 8 lines · Wei Yang

Two cleanups in this patch:

* since pageblock_nr_pages == (1 << pageblock_order), the roundup() and right shift pageblock_order could be replaced with DIV_ROUND_UP()
* use BITS_TO_LONGS() to get number of bytes for bitmap

This patch also fix one typo in comment.

Patch 1 maybe controversial, how about this one :-)

Look forward some comments.

Quoted 36 lines

---
mm/page_alloc.c | 9 +++------

1 file changed, 3 insertions(+), 6 deletions(-)
mm/page_alloc.c +3 -6
index 7c745c305332..baf473f80800 100644
@@ -6204,7 +6204,7 @@ static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
 /*
 * Calculate the size of the zone->blockflags rounded to an unsigned long
 * Start by making sure zonesize is a multiple of pageblock_order by rounding
- * up. Then use 1 NR_PAGEBLOCK_BITS worth of bits per pageblock, finally
+ * up. Then use 1 NR_PAGEBLOCK_BITS width of bits per pageblock, finally
 * round what is now in bits to nearest long in bits, then return it in
 * bytes.
 */
@@ -6213,12 +6213,9 @@ static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned l
 	unsigned long usemapsize;
 
 	zonesize += zone_start_pfn & (pageblock_nr_pages-1);
-	usemapsize = roundup(zonesize, pageblock_nr_pages);
-	usemapsize = usemapsize >> pageblock_order;
+	usemapsize = DIV_ROUND_UP(zonesize, pageblock_nr_pages);
 	usemapsize *= NR_PAGEBLOCK_BITS;
-	usemapsize = roundup(usemapsize, 8 * sizeof(unsigned long));
-
-	return usemapsize / 8;
+	return BITS_TO_LONGS(usemapsize) * sizeof(unsigned long);
 }
 
 static void __ref setup_usemap(struct pglist_data *pgdat,
Signature · 1 line
2.15.1
Signature · 2 lines
Wei Yang
Help you, Help me
#3 lore raw
In reply to Wei Yang
Quoted 7 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

Signature · 2 lines
Mel Gorman
SUSE Labs
author
#4 lore raw
Quoted 7 lines · Mel Gorman
Quoted 6 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Quoted 7 lines
Quoted 1 line

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

pageblock_order has two definitions.

    #define pageblock_order        HUGETLB_PAGE_ORDER

    #define pageblock_order        (MAX_ORDER-1)

If CONFIG_HUGETLB_PAGE is not enabled, pageblock_order is related to MAX_ORDER, which ensures it is smaller than section size.

If CONFIG_HUGETLB_PAGE is enabled, pageblock_order is not related to MAX_ORDER. I don't see HUGETLB_PAGE_ORDER is ensured to be less than section size. Maybe I missed it?

Quoted 4 lines
Signature · 3 lines
-- 
Mel Gorman
SUSE Labs
Signature · 2 lines
Wei Yang
Help you, Help me
#5 lore raw
Quoted 22 lines · Wei Yang
Quoted 7 lines · Mel Gorman
Quoted 6 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Quoted 7 lines
Quoted 1 line

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

pageblock_order has two definitions.

    #define pageblock_order        HUGETLB_PAGE_ORDER

    #define pageblock_order        (MAX_ORDER-1)
Quoted 7 lines

If CONFIG_HUGETLB_PAGE is not enabled, pageblock_order is related to MAX_ORDER, which ensures it is smaller than section size.

If CONFIG_HUGETLB_PAGE is enabled, pageblock_order is not related to MAX_ORDER. I don't see HUGETLB_PAGE_ORDER is ensured to be less than section size. Maybe I missed it?

HUGETLB_PAGE_ORDER is less than MAX_ORDER on the basis that normal huge pages (not gigantic) pages are served from the buddy allocator which is limited by MAX_ORDER.

Signature · 2 lines
Mel Gorman
SUSE Labs
author
#6 lore raw
Quoted 26 lines · Mel Gorman
Quoted 25 lines · Wei Yang
Quoted 7 lines · Mel Gorman
Quoted 6 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Quoted 7 lines
Quoted 1 line

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

pageblock_order has two definitions.

    #define pageblock_order        HUGETLB_PAGE_ORDER

    #define pageblock_order        (MAX_ORDER-1)

If CONFIG_HUGETLB_PAGE is not enabled, pageblock_order is related to MAX_ORDER, which ensures it is smaller than section size.

Quoted 9 lines
Quoted 4 lines

If CONFIG_HUGETLB_PAGE is enabled, pageblock_order is not related to MAX_ORDER. I don't see HUGETLB_PAGE_ORDER is ensured to be less than section size. Maybe I missed it?

HUGETLB_PAGE_ORDER is less than MAX_ORDER on the basis that normal huge pages (not gigantic) pages are served from the buddy allocator which is limited by MAX_ORDER.

Maybe I am lost here, I got one possible definition on x86.

#define pageblock_order HUGETLB_PAGE_ORDER
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
#define HPAGE_SHIFT PMD_SHIFT
#define PMD_SHIFT PUD_SHIFT
#define PUD_SHIFT 30

This leads to pageblock_order = (30 - 12) = 18 > MAX_ORDER ?

What you mentioned sounds reasonable. A huge page should be less than MAX_ORDER, otherwise page allocator couldn't handle it. But I don't see the connection between MAX_ORDER and HUGETLB_PAGE_ORDER. Do we need to add a check on this? Or it already has similar contrain in code, but I missed it?

Quoted 3 lines
Signature · 2 lines
Mel Gorman
SUSE Labs
Signature · 2 lines
Wei Yang
Help you, Help me
#7 lore raw
Quoted 37 lines · Wei Yang
Quoted 26 lines · Mel Gorman
Quoted 25 lines · Wei Yang
Quoted 7 lines · Mel Gorman
Quoted 6 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Quoted 7 lines
Quoted 1 line

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

pageblock_order has two definitions.

    #define pageblock_order        HUGETLB_PAGE_ORDER

    #define pageblock_order        (MAX_ORDER-1)

If CONFIG_HUGETLB_PAGE is not enabled, pageblock_order is related to MAX_ORDER, which ensures it is smaller than section size.

Quoted 9 lines
Quoted 4 lines

If CONFIG_HUGETLB_PAGE is enabled, pageblock_order is not related to MAX_ORDER. I don't see HUGETLB_PAGE_ORDER is ensured to be less than section size. Maybe I missed it?

HUGETLB_PAGE_ORDER is less than MAX_ORDER on the basis that normal huge pages (not gigantic) pages are served from the buddy allocator which is limited by MAX_ORDER.

Quoted 6 lines

Maybe I am lost here, I got one possible definition on x86.

#define pageblock_order HUGETLB_PAGE_ORDER
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
#define HPAGE_SHIFT PMD_SHIFT
#define PMD_SHIFT PUD_SHIFT

PMD_SHIFT is usually 21

arch/x86/include/asm/pgtable-3level_types.h:#define PMD_SHIFT 21
arch/x86/include/asm/pgtable_64_types.h:#define PMD_SHIFT 21

Unless CONFIG_PGTABLE_LEVELS <= 2

Then include/asm-generic/pgtable-nopmd.h will be used in arch/x86/include/asm/pgtable_types.h

	#define PMD_SHIFT	PUD_SHIFT

In that case, also include/asm-generic/pgtable-nopmd.h is uses

	#define PUD_SHIFT	P4D_SHIFT

... include/asm-generic/pgtable-nop4d.h

	#define P4D_SHIFT	PGDIR_SHIFT

And that would be arch/x86/include/asm/pgtable-2level_types.h:#define PGDIR_SHIFT 22

If I am not wrong.

So we would have pageblock_order = (22 - 12) = 10

Quoted 14 lines

#define PUD_SHIFT 30

This leads to pageblock_order = (30 - 12) = 18 > MAX_ORDER ?

What you mentioned sounds reasonable. A huge page should be less than MAX_ORDER, otherwise page allocator couldn't handle it. But I don't see the connection between MAX_ORDER and HUGETLB_PAGE_ORDER. Do we need to add a check on this? Or it already has similar contrain in code, but I missed it?

Quoted 3 lines
Signature · 2 lines
Mel Gorman
SUSE Labs
Signature · 3 lines
Thanks,

David / dhildenb
author
#8 lore raw
Quoted 63 lines · David Hildenbrand
Quoted 37 lines · Wei Yang
Quoted 26 lines · Mel Gorman
Quoted 25 lines · Wei Yang
Quoted 7 lines · Mel Gorman
Quoted 6 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Quoted 7 lines
Quoted 1 line

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

pageblock_order has two definitions.

    #define pageblock_order        HUGETLB_PAGE_ORDER

    #define pageblock_order        (MAX_ORDER-1)

If CONFIG_HUGETLB_PAGE is not enabled, pageblock_order is related to MAX_ORDER, which ensures it is smaller than section size.

Quoted 9 lines
Quoted 4 lines

If CONFIG_HUGETLB_PAGE is enabled, pageblock_order is not related to MAX_ORDER. I don't see HUGETLB_PAGE_ORDER is ensured to be less than section size. Maybe I missed it?

HUGETLB_PAGE_ORDER is less than MAX_ORDER on the basis that normal huge pages (not gigantic) pages are served from the buddy allocator which is limited by MAX_ORDER.

Quoted 6 lines

Maybe I am lost here, I got one possible definition on x86.

#define pageblock_order HUGETLB_PAGE_ORDER
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
#define HPAGE_SHIFT PMD_SHIFT
#define PMD_SHIFT PUD_SHIFT

PMD_SHIFT is usually 21

arch/x86/include/asm/pgtable-3level_types.h:#define PMD_SHIFT 21
arch/x86/include/asm/pgtable_64_types.h:#define PMD_SHIFT 21

Unless CONFIG_PGTABLE_LEVELS <= 2

Then include/asm-generic/pgtable-nopmd.h will be used in arch/x86/include/asm/pgtable_types.h

	#define PMD_SHIFT	PUD_SHIFT

In that case, also include/asm-generic/pgtable-nopmd.h is uses

	#define PUD_SHIFT	P4D_SHIFT

... include/asm-generic/pgtable-nop4d.h

	#define P4D_SHIFT	PGDIR_SHIFT
Quoted 7 lines

And that would be arch/x86/include/asm/pgtable-2level_types.h:#define PGDIR_SHIFT 22

If I am not wrong.

So we would have pageblock_order = (22 - 12) = 10

Thank, David :-)

I think current configuration is correct, while all these digits are written by programmer.

My concern and suggestion is to add a compiler check to enforce this. So that we would avoid this situation if someone miss this constrain. Just as the check on MAX_ORDER and SECION_SIZE.

Quoted 22 lines
Quoted 15 lines

#define PUD_SHIFT 30

This leads to pageblock_order = (30 - 12) = 18 > MAX_ORDER ?

What you mentioned sounds reasonable. A huge page should be less than MAX_ORDER, otherwise page allocator couldn't handle it. But I don't see the connection between MAX_ORDER and HUGETLB_PAGE_ORDER. Do we need to add a check on this? Or it already has similar contrain in code, but I missed it?

Quoted 3 lines
Signature · 2 lines
Mel Gorman
SUSE Labs
Signature · 3 lines
Thanks,

David / dhildenb
Signature · 2 lines
Wei Yang
Help you, Help me
#9 lore raw
Quoted 72 lines · Wei Yang
Quoted 63 lines · David Hildenbrand
Quoted 37 lines · Wei Yang
Quoted 26 lines · Mel Gorman
Quoted 25 lines · Wei Yang
Quoted 7 lines · Mel Gorman
Quoted 6 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Quoted 7 lines
Quoted 1 line

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

pageblock_order has two definitions.

    #define pageblock_order        HUGETLB_PAGE_ORDER

    #define pageblock_order        (MAX_ORDER-1)

If CONFIG_HUGETLB_PAGE is not enabled, pageblock_order is related to MAX_ORDER, which ensures it is smaller than section size.

Quoted 9 lines
Quoted 4 lines

If CONFIG_HUGETLB_PAGE is enabled, pageblock_order is not related to MAX_ORDER. I don't see HUGETLB_PAGE_ORDER is ensured to be less than section size. Maybe I missed it?

HUGETLB_PAGE_ORDER is less than MAX_ORDER on the basis that normal huge pages (not gigantic) pages are served from the buddy allocator which is limited by MAX_ORDER.

Quoted 6 lines

Maybe I am lost here, I got one possible definition on x86.

#define pageblock_order HUGETLB_PAGE_ORDER
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
#define HPAGE_SHIFT PMD_SHIFT
#define PMD_SHIFT PUD_SHIFT

PMD_SHIFT is usually 21

arch/x86/include/asm/pgtable-3level_types.h:#define PMD_SHIFT 21
arch/x86/include/asm/pgtable_64_types.h:#define PMD_SHIFT 21

Unless CONFIG_PGTABLE_LEVELS <= 2

Then include/asm-generic/pgtable-nopmd.h will be used in arch/x86/include/asm/pgtable_types.h

	#define PMD_SHIFT	PUD_SHIFT

In that case, also include/asm-generic/pgtable-nopmd.h is uses

	#define PUD_SHIFT	P4D_SHIFT

... include/asm-generic/pgtable-nop4d.h

	#define P4D_SHIFT	PGDIR_SHIFT
Quoted 7 lines

And that would be arch/x86/include/asm/pgtable-2level_types.h:#define PGDIR_SHIFT 22

If I am not wrong.

So we would have pageblock_order = (22 - 12) = 10

Quoted 8 lines

Thank, David :-)

I think current configuration is correct, while all these digits are written by programmer.

My concern and suggestion is to add a compiler check to enforce this. So that we would avoid this situation if someone miss this constrain. Just as the check on MAX_ORDER and SECION_SIZE.

I am not completely against this, I rather wonder if it is needed because I assume other things will break horribly in case this is violated. And at that would only be helpful for somebody developing for a new architecture/flavor.

As I am a friend of documenting things that are not obvious, I would rather suggest to add a comment to the

	#define pageblock_order		HUGETLB_PAGE_ORDER

line, stating what we just learned.

/*
* HUGETLB_PAGE_ORDER will always be smaller than MAX_ORDER, so that
* huge (not gigantic) pages can be served from the buddy allocator. */

Signature · 3 lines
Thanks,

David / dhildenb
author
#10 lore raw
Quoted 78 lines · David Hildenbrand
Quoted 77 lines · Wei Yang
Quoted 63 lines · David Hildenbrand
Quoted 37 lines · Wei Yang
Quoted 26 lines · Mel Gorman
Quoted 25 lines · Wei Yang
Quoted 7 lines · Mel Gorman
Quoted 6 lines · Wei Yang

When SPARSEMEM is used, there is an indication that pageblock is not allowed to exceed one mem_section. Current code doesn't have this constrain explicitly.

This patch adds this to make sure it won't.

Quoted 7 lines
Quoted 1 line

Is this even possible? This would imply that the section size is smaller than max order which would be quite a crazy selection for a sparesemem section size. A lot of assumptions on the validity of PFNs within a max-order boundary would be broken with such a section size. I'd be surprised if such a setup could even boot, let alone run.

pageblock_order has two definitions.

    #define pageblock_order        HUGETLB_PAGE_ORDER

    #define pageblock_order        (MAX_ORDER-1)

If CONFIG_HUGETLB_PAGE is not enabled, pageblock_order is related to MAX_ORDER, which ensures it is smaller than section size.

Quoted 9 lines
Quoted 4 lines

If CONFIG_HUGETLB_PAGE is enabled, pageblock_order is not related to MAX_ORDER. I don't see HUGETLB_PAGE_ORDER is ensured to be less than section size. Maybe I missed it?

HUGETLB_PAGE_ORDER is less than MAX_ORDER on the basis that normal huge pages (not gigantic) pages are served from the buddy allocator which is limited by MAX_ORDER.

Quoted 6 lines

Maybe I am lost here, I got one possible definition on x86.

#define pageblock_order HUGETLB_PAGE_ORDER
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
#define HPAGE_SHIFT PMD_SHIFT
#define PMD_SHIFT PUD_SHIFT

PMD_SHIFT is usually 21

arch/x86/include/asm/pgtable-3level_types.h:#define PMD_SHIFT 21
arch/x86/include/asm/pgtable_64_types.h:#define PMD_SHIFT 21

Unless CONFIG_PGTABLE_LEVELS <= 2

Then include/asm-generic/pgtable-nopmd.h will be used in arch/x86/include/asm/pgtable_types.h

	#define PMD_SHIFT	PUD_SHIFT

In that case, also include/asm-generic/pgtable-nopmd.h is uses

	#define PUD_SHIFT	P4D_SHIFT

... include/asm-generic/pgtable-nop4d.h

	#define P4D_SHIFT	PGDIR_SHIFT
Quoted 7 lines

And that would be arch/x86/include/asm/pgtable-2level_types.h:#define PGDIR_SHIFT 22

If I am not wrong.

So we would have pageblock_order = (22 - 12) = 10

Thank, David :-)

I think current configuration is correct, while all these digits are written by programmer.

Quoted 8 lines
Quoted 3 lines

My concern and suggestion is to add a compiler check to enforce this. So that we would avoid this situation if someone miss this constrain. Just as the check on MAX_ORDER and SECION_SIZE.

I am not completely against this, I rather wonder if it is needed because I assume other things will break horribly in case this is violated. And at that would only be helpful for somebody developing for a new architecture/flavor.

I think you are right.

Quoted 11 lines

As I am a friend of documenting things that are not obvious, I would rather suggest to add a comment to the

	#define pageblock_order		HUGETLB_PAGE_ORDER

line, stating what we just learned.

/*
* HUGETLB_PAGE_ORDER will always be smaller than MAX_ORDER, so that
* huge (not gigantic) pages can be served from the buddy allocator. */

This looks good to me. Let's see which one others prefer :-)

Quoted 6 lines
Signature · 5 lines
-- 

Thanks,

David / dhildenb
Signature · 2 lines
Wei Yang
Help you, Help me
#11 lore raw
In reply to Wei Yang
Thank you for the patch! Perhaps something to improve:

Hi Wei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc5 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-pageblock-make-sure-pageblock-won-t-exceed-mem_sectioin/20181207-030601
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

In file included from include/linux/gfp.h:6:0,

                    from include/linux/xarray.h:14,
                    from include/linux/radix-tree.h:31,
                    from include/linux/fs.h:15,
                    from include/linux/compat.h:17,
                    from arch/powerpc/kernel/asm-offsets.c:16:
>> include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]
    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
--
   In file included from include/linux/gfp.h:6:0,
                    from include/linux/mm.h:10,
                    from mm//swap.c:16:
>> include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]
    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
   In file included from include/linux/gfp.h:6:0,
                    from include/linux/mm.h:10,
                    from mm//swap.c:16:
>> include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]
    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~

vim +/pageblock_order +1088 include/linux/mmzone.h

1087

> 1088	#if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS

1089 #error Allocator pageblock_order exceeds SECTION_SIZE
1090 #endif
1091

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author
#12 lore raw
Quoted 42 lines · kbuild test robot

Hi Wei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc5 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-pageblock-make-sure-pageblock-won-t-exceed-mem_sectioin/20181207-030601
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

In file included from include/linux/gfp.h:6:0,

                   from include/linux/xarray.h:14,
                   from include/linux/radix-tree.h:31,
                   from include/linux/fs.h:15,
                   from include/linux/compat.h:17,
                   from arch/powerpc/kernel/asm-offsets.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

   #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
        ^~~~~~~~~~~~~~~
--
  In file included from include/linux/gfp.h:6:0,
                   from include/linux/mm.h:10,
                   from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

   #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
        ^~~~~~~~~~~~~~~
  In file included from include/linux/gfp.h:6:0,
                   from include/linux/mm.h:10,
                   from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

   #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
        ^~~~~~~~~~~~~~~
Quoted 8 lines

vim +/pageblock_order +1088 include/linux/mmzone.h

1087

Quoted 1 line

1088 #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS

1089 #error Allocator pageblock_order exceeds SECTION_SIZE
1090 #endif
1091

I took a look at the latest code, at line 1082 of the same file uses pageblock_order. And I apply this patch on top of v4.20-rc5, the build looks good to me.

Confused why this introduce an compile error.

Quoted 3 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Signature · 2 lines
Wei Yang
Help you, Help me
#13 lore raw
Quoted 51 lines · Wei Yang
Quoted 42 lines · kbuild test robot

Hi Wei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc5 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-pageblock-make-sure-pageblock-won-t-exceed-mem_sectioin/20181207-030601
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

In file included from include/linux/gfp.h:6:0,

                    from include/linux/xarray.h:14,
                    from include/linux/radix-tree.h:31,
                    from include/linux/fs.h:15,
                    from include/linux/compat.h:17,
                    from arch/powerpc/kernel/asm-offsets.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
--
   In file included from include/linux/gfp.h:6:0,
                    from include/linux/mm.h:10,
                    from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
   In file included from include/linux/gfp.h:6:0,
                    from include/linux/mm.h:10,
                    from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
Quoted 8 lines

vim +/pageblock_order +1088 include/linux/mmzone.h

1087

Quoted 1 line

1088 #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS

1089 #error Allocator pageblock_order exceeds SECTION_SIZE
1090 #endif
1091

Quoted 5 lines

I took a look at the latest code, at line 1082 of the same file uses pageblock_order. And I apply this patch on top of v4.20-rc5, the build looks good to me.

Confused why this introduce an compile error.

Hi Wei,

we could reproduce the warnings with using make.cross.

Best Regards,
Rong Chen

Quoted 6 lines
Quoted 4 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author
#14 lore raw
Quoted 58 lines · Rong Chen
Quoted 55 lines · Wei Yang
Quoted 42 lines · kbuild test robot

Hi Wei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc5 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-pageblock-make-sure-pageblock-won-t-exceed-mem_sectioin/20181207-030601
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

In file included from include/linux/gfp.h:6:0,

                    from include/linux/xarray.h:14,
                    from include/linux/radix-tree.h:31,
                    from include/linux/fs.h:15,
                    from include/linux/compat.h:17,
                    from arch/powerpc/kernel/asm-offsets.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
--
   In file included from include/linux/gfp.h:6:0,
                    from include/linux/mm.h:10,
                    from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
   In file included from include/linux/gfp.h:6:0,
                    from include/linux/mm.h:10,
                    from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~
Quoted 8 lines

vim +/pageblock_order +1088 include/linux/mmzone.h

1087

Quoted 1 line

1088 #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS

1089 #error Allocator pageblock_order exceeds SECTION_SIZE
1090 #endif
1091

I took a look at the latest code, at line 1082 of the same file uses pageblock_order. And I apply this patch on top of v4.20-rc5, the build looks good to me.

Quoted 6 lines
Quoted 1 line

Confused why this introduce an compile error.

Hi Wei,

we could reproduce the warnings with using make.cross.

That's interesting.

Do you see this file already use pageblock_order in line 1081?

Is this one report warning?

Quoted 9 lines

Best Regards,
Rong Chen

Quoted 6 lines
Quoted 4 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Signature · 2 lines
Wei Yang
Help you, Help me
#15 lore raw
Quoted 61 lines · Wei Yang
Quoted 60 lines · Rong Chen
Quoted 51 lines · Wei Yang
Quoted 42 lines · kbuild test robot

Hi Wei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc5 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-pageblock-make-sure-pageblock-won-t-exceed-mem_sectioin/20181207-030601
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

In file included from include/linux/gfp.h:6:0,
from include/linux/xarray.h:14, from include/linux/radix-tree.h:31, from include/linux/fs.h:15,
from include/linux/compat.h:17, from arch/powerpc/kernel/asm-offsets.c:16:

Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

     #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
          ^~~~~~~~~~~~~~~
--
    In file included from include/linux/gfp.h:6:0,
                     from include/linux/mm.h:10,
                     from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

     #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
          ^~~~~~~~~~~~~~~
    In file included from include/linux/gfp.h:6:0,
                     from include/linux/mm.h:10,
                     from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

     #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
          ^~~~~~~~~~~~~~~
Quoted 8 lines

vim +/pageblock_order +1088 include/linux/mmzone.h

   1087	
Quoted 1 line

1088 #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS

1089 #error Allocator pageblock_order exceeds SECTION_SIZE
1090 #endif
1091

Quoted 5 lines

I took a look at the latest code, at line 1082 of the same file uses pageblock_order. And I apply this patch on top of v4.20-rc5, the build looks good to me.

Confused why this introduce an compile error.

Hi Wei,

Quoted 8 lines
Quoted 2 lines

we could reproduce the warnings with using make.cross.

That's interesting.

Do you see this file already use pageblock_order in line 1081?

Is this one report warning?

both questions is yes.

Best Regards,
Rong Chen

author
#16 lore raw
Quoted 66 lines · Rong Chen
Quoted 63 lines · Wei Yang
Quoted 62 lines · Rong Chen
Quoted 51 lines · Wei Yang
Quoted 42 lines · kbuild test robot

Hi Wei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc5 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-pageblock-make-sure-pageblock-won-t-exceed-mem_sectioin/20181207-030601
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

In file included from include/linux/gfp.h:6:0,
from include/linux/xarray.h:14, from include/linux/radix-tree.h:31, from include/linux/fs.h:15,
from include/linux/compat.h:17, from arch/powerpc/kernel/asm-offsets.c:16:

Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

     #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
          ^~~~~~~~~~~~~~~
--
    In file included from include/linux/gfp.h:6:0,
                     from include/linux/mm.h:10,
                     from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

     #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
          ^~~~~~~~~~~~~~~
    In file included from include/linux/gfp.h:6:0,
                     from include/linux/mm.h:10,
                     from mm//swap.c:16:
Quoted 1 line
Quoted 1 line

include/linux/mmzone.h:1088:6: warning: "pageblock_order" is not defined, evaluates to 0 [-Wundef]

     #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
          ^~~~~~~~~~~~~~~
Quoted 8 lines

vim +/pageblock_order +1088 include/linux/mmzone.h

   1087	
Quoted 1 line

1088 #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS

1089 #error Allocator pageblock_order exceeds SECTION_SIZE
1090 #endif
1091

Quoted 5 lines

I took a look at the latest code, at line 1082 of the same file uses pageblock_order. And I apply this patch on top of v4.20-rc5, the build looks good to me.

Confused why this introduce an compile error.

Hi Wei,

we could reproduce the warnings with using make.cross.

Quoted 9 lines
Quoted 6 lines

That's interesting.

Do you see this file already use pageblock_order in line 1081?

Is this one report warning?

both questions is yes.

Sounds interesting :-)

I don't have a power machine and we may drop this patch as discussed, so I won't look into this now.

Thanks for your effort.

Quoted 4 lines

Best Regards,
Rong Chen

Signature · 2 lines
Wei Yang
Help you, Help me
#17 lore raw
In reply to Wei Yang
Thank you for the patch! Yet something to improve:

Hi Wei,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.20-rc5 next-20181207]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Wei-Yang/mm-pageblock-make-sure-pageblock-won-t-exceed-mem_sectioin/20181207-030601
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

In file included from include/linux/gfp.h:6:0,
from include/linux/umh.h:4, from include/linux/kmod.h:22, from include/linux/module.h:13, from drivers/misc/ocxl/main.c:3:

>> include/linux/mmzone.h:1088:6: error: "pageblock_order" is not defined, evaluates to 0 [-Werror=undef]
    #if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS
         ^~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

vim +/pageblock_order +1088 include/linux/mmzone.h

1087

> 1088	#if (pageblock_order + PAGE_SHIFT) > SECTION_SIZE_BITS

1089 #error Allocator pageblock_order exceeds SECTION_SIZE
1090 #endif
1091

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation