2017-06-14 07:27:09

by Guenter Roeck

[permalink] [raw]
Subject: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

Hi,

I see the following build error in -next when building hexagon images.

CC arch/hexagon/kernel/asm-offsets.s
In file included from ./include/linux/memcontrol.h:30:0,
from ./include/linux/swap.h:8,
from ./arch/hexagon/include/asm/pgtable.h:27,
from ./include/linux/mm.h:70,
from arch/hexagon/kernel/asm-offsets.c:28:
./include/linux/vmstat.h: In function '__inc_zone_page_state':
./include/linux/vmstat.h:294:2: error: implicit declaration of function 'page_zone' [-Werror=implicit-function-declaration]
./include/linux/vmstat.h:294:2: warning: passing argument 1 of '__inc_zone_state' makes pointer from integer without a cast [enabled by default]
./include/linux/vmstat.h:267:20: note: expected 'struct zone *' but argument is of type 'int'
./include/linux/vmstat.h: In function '__inc_node_page_state':
./include/linux/vmstat.h:300:2: error: implicit declaration of function 'page_pgdat' [-Werror=implicit-function-declaration]
./include/linux/vmstat.h:300:2: warning: passing argument 1 of '__inc_node_state' makes pointer from integer without a cast [enabled by default]
./include/linux/vmstat.h:273:20: note: expected 'struct pglist_data *' but argument is of type 'int'
./include/linux/vmstat.h: In function '__dec_zone_page_state':
./include/linux/vmstat.h:307:2: warning: passing argument 1 of '__dec_zone_state' makes pointer from integer without a cast [enabled by default]
./include/linux/vmstat.h:279:20: note: expected 'struct zone *' but argument is of type 'int'
./include/linux/vmstat.h: In function '__dec_node_page_state':
./include/linux/vmstat.h:313:2: warning: passing argument 1 of '__dec_node_state' makes pointer from integer without a cast [enabled by default]
./include/linux/vmstat.h:285:20: note: expected 'struct pglist_data *' but argument is of type 'int'

Bisect points to 'mm: memcontrol: per-lruvec stats infrastructure'. Bisect log is attached.

Guenter

---

# bad: [b14746170b0684005bab3e07893e6b91baf7dbf6] Add linux-next specific files for 20170614
# good: [32c1431eea4881a6b17bd7c639315010aeefa452] Linux 4.12-rc5
git bisect start 'HEAD' 'v4.12-rc5'
# good: [0500b956eedb4686b0420308ae01a74b00f9ab64] Merge remote-tracking branch 'crypto/master'
git bisect good 0500b956eedb4686b0420308ae01a74b00f9ab64
# good: [4717c17660509cee9d3596eb19b99f3e26d57c36] Merge remote-tracking branch 'tip/auto-latest'
git bisect good 4717c17660509cee9d3596eb19b99f3e26d57c36
# good: [ad001607f386be7fc1f4353c550e7cf14ac7026c] Merge remote-tracking branch 'slave-dma/next'
git bisect good ad001607f386be7fc1f4353c550e7cf14ac7026c
# good: [0222e195b36f0ae047f728d68f9c2310c1b310e0] Merge remote-tracking branch 'gpio/for-next'
git bisect good 0222e195b36f0ae047f728d68f9c2310c1b310e0
# bad: [ed151d2581a7ed2bcd6cd13e0f7a6980356b0990] ipc: merge ipc_rcu and kern_ipc_perm
git bisect bad ed151d2581a7ed2bcd6cd13e0f7a6980356b0990
# good: [68fd987c837e601ae322ce812968b20d9b0e63d0] mm/oom_kill: count global and memory cgroup oom kills
git bisect good 68fd987c837e601ae322ce812968b20d9b0e63d0
# bad: [d931ca9904caddd5aeca14d8bc89365774075971] sh64: ascii armor the sh64 boot init stack canary
git bisect bad d931ca9904caddd5aeca14d8bc89365774075971
# bad: [7c54a485ad62b9b1c04f1104650bcf6be7fdaf2c] mm: hugetlb: soft-offline: dissolve source hugepage after successful migration
git bisect bad 7c54a485ad62b9b1c04f1104650bcf6be7fdaf2c
# bad: [90cca56e4ed5a8e707dba7bcecd5e72d9f45cd9f] mm: memcontrol: per-lruvec stats infrastructure fix 3
git bisect bad 90cca56e4ed5a8e707dba7bcecd5e72d9f45cd9f
# good: [d955b3fb9e7fb6dfca433d482187636ba2c3938b] mm/zswap.c: delete an error message for a failed memory allocation in zswap_dstmem_prepare()
git bisect good d955b3fb9e7fb6dfca433d482187636ba2c3938b
# good: [9a2176b1242f1f31c4136ac85cfcb0348851ad20] mm: memcontrol: use generic mod_memcg_page_state for kmem pages
git bisect good 9a2176b1242f1f31c4136ac85cfcb0348851ad20
# bad: [5eeb97bbd4d67c49b9bf3108b72b909dd7c6b5ce] mm-memcontrol-per-lruvec-stats-infrastructure-fix
git bisect bad 5eeb97bbd4d67c49b9bf3108b72b909dd7c6b5ce
# bad: [fb6646f52c459b87ecd033521bc6fd0a7640d334] mm: memcontrol: per-lruvec stats infrastructure
git bisect bad fb6646f52c459b87ecd033521bc6fd0a7640d334
# first bad commit: [fb6646f52c459b87ecd033521bc6fd0a7640d334] mm: memcontrol: per-lruvec stats infrastructure


2017-06-16 18:50:02

by Johannes Weiner

[permalink] [raw]
Subject: Re: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

Hi Guenter,

On Wed, Jun 14, 2017 at 12:26:46AM -0700, Guenter Roeck wrote:
> Hi,
>
> I see the following build error in -next when building hexagon images.
>
> CC arch/hexagon/kernel/asm-offsets.s
> In file included from ./include/linux/memcontrol.h:30:0,
> from ./include/linux/swap.h:8,
> from ./arch/hexagon/include/asm/pgtable.h:27,
> from ./include/linux/mm.h:70,
> from arch/hexagon/kernel/asm-offsets.c:28:
> ./include/linux/vmstat.h: In function '__inc_zone_page_state':
> ./include/linux/vmstat.h:294:2: error: implicit declaration of function 'page_zone' [-Werror=implicit-function-declaration]
> ./include/linux/vmstat.h:294:2: warning: passing argument 1 of '__inc_zone_state' makes pointer from integer without a cast [enabled by default]
> ./include/linux/vmstat.h:267:20: note: expected 'struct zone *' but argument is of type 'int'

vmstat.h depends on definitions in mm.h, but mm.h through the above
chain includes vmstat.h first. It worked in my x86 test because x86
pgtable.h doesn't include swap.h.

The headers are a bit of a mess. memcontrol.h is supposed to be a
lower level header than mm.h and vmstat.h, yet the new accounting
functions depend on mm.h definitions.

Let's move the lruvec accounting infra to vmstat.h and shuffle
memcontrol.h into the stack under mm.h and vmstat.h.

Does the following fix the hexagon build?

---

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index da9360885260..10042ada06e6 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -26,8 +26,6 @@
#include <linux/page_counter.h>
#include <linux/vmpressure.h>
#include <linux/eventfd.h>
-#include <linux/mm.h>
-#include <linux/vmstat.h>
#include <linux/writeback.h>
#include <linux/page-flags.h>

@@ -536,78 +534,6 @@ static inline void mod_memcg_page_state(struct page *page,
mod_memcg_state(page->mem_cgroup, idx, val);
}

-static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- struct mem_cgroup_per_node *pn;
- long val = 0;
- int cpu;
-
- if (mem_cgroup_disabled())
- return node_page_state(lruvec_pgdat(lruvec), idx);
-
- pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
- for_each_possible_cpu(cpu)
- val += per_cpu(pn->lruvec_stat->count[idx], cpu);
-
- if (val < 0)
- val = 0;
-
- return val;
-}
-
-static inline void __mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
- if (mem_cgroup_disabled())
- return;
- pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
- __mod_memcg_state(pn->memcg, idx, val);
- __this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
-static inline void mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
- if (mem_cgroup_disabled())
- return;
- pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
- mod_memcg_state(pn->memcg, idx, val);
- this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
-static inline void __mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- __mod_node_page_state(page_pgdat(page), idx, val);
- if (mem_cgroup_disabled() || !page->mem_cgroup)
- return;
- __mod_memcg_state(page->mem_cgroup, idx, val);
- pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
- __this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
-static inline void mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- mod_node_page_state(page_pgdat(page), idx, val);
- if (mem_cgroup_disabled() || !page->mem_cgroup)
- return;
- mod_memcg_state(page->mem_cgroup, idx, val);
- pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
- this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
gfp_t gfp_mask,
unsigned long *total_scanned);
@@ -835,36 +761,6 @@ static inline void mod_memcg_page_state(struct page *page,
{
}

-static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- return node_page_state(lruvec_pgdat(lruvec), idx);
-}
-
-static inline void __mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
-}
-
-static inline void mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
-}
-
-static inline void __mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- __mod_node_page_state(page_pgdat(page), idx, val);
-}
-
-static inline void mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- mod_node_page_state(page_pgdat(page), idx, val);
-}
-
static inline
unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
gfp_t gfp_mask,
@@ -907,30 +803,6 @@ static inline void __dec_memcg_page_state(struct page *page,
__mod_memcg_page_state(page, idx, -1);
}

-static inline void __inc_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- __mod_lruvec_state(lruvec, idx, 1);
-}
-
-static inline void __dec_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- __mod_lruvec_state(lruvec, idx, -1);
-}
-
-static inline void __inc_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- __mod_lruvec_page_state(page, idx, 1);
-}
-
-static inline void __dec_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- __mod_lruvec_page_state(page, idx, -1);
-}
-
static inline void inc_memcg_state(struct mem_cgroup *memcg,
enum memcg_stat_item idx)
{
@@ -955,30 +827,6 @@ static inline void dec_memcg_page_state(struct page *page,
mod_memcg_page_state(page, idx, -1);
}

-static inline void inc_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- mod_lruvec_state(lruvec, idx, 1);
-}
-
-static inline void dec_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- mod_lruvec_state(lruvec, idx, -1);
-}
-
-static inline void inc_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- mod_lruvec_page_state(page, idx, 1);
-}
-
-static inline void dec_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- mod_lruvec_page_state(page, idx, -1);
-}
-
#ifdef CONFIG_CGROUP_WRITEBACK

struct list_head *mem_cgroup_cgwb_list(struct mem_cgroup *memcg);
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index b3d85f30d424..4c52a9f7b6a4 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -6,6 +6,7 @@
#include <linux/mmzone.h>
#include <linux/vm_event_item.h>
#include <linux/atomic.h>
+#include <linux/memcontrol.h>

extern int sysctl_stat_interval;

@@ -350,4 +351,156 @@ static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages,

extern const char * const vmstat_text[];

+#ifdef CONFIG_MEMCG
+static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ struct mem_cgroup_per_node *pn;
+ long val = 0;
+ int cpu;
+
+ if (mem_cgroup_disabled())
+ return node_page_state(lruvec_pgdat(lruvec), idx);
+
+ pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
+ for_each_possible_cpu(cpu)
+ val += per_cpu(pn->lruvec_stat->count[idx], cpu);
+
+ if (val < 0)
+ val = 0;
+
+ return val;
+}
+
+static inline void __mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+ if (mem_cgroup_disabled())
+ return;
+ pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
+ __mod_memcg_state(pn->memcg, idx, val);
+ __this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+
+static inline void mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+ if (mem_cgroup_disabled())
+ return;
+ pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
+ mod_memcg_state(pn->memcg, idx, val);
+ this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+
+static inline void __mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ __mod_node_page_state(page_pgdat(page), idx, val);
+ if (mem_cgroup_disabled() || !page->mem_cgroup)
+ return;
+ __mod_memcg_state(page->mem_cgroup, idx, val);
+ pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
+ __this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+
+static inline void mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ mod_node_page_state(page_pgdat(page), idx, val);
+ if (mem_cgroup_disabled() || !page->mem_cgroup)
+ return;
+ mod_memcg_state(page->mem_cgroup, idx, val);
+ pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
+ this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+#else /* CONFIG_MEMCG */
+static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ return node_page_state(lruvec_pgdat(lruvec), idx);
+}
+
+static inline void __mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+}
+
+static inline void mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+}
+
+static inline void __mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ __mod_node_page_state(page_pgdat(page), idx, val);
+}
+
+static inline void mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ mod_node_page_state(page_pgdat(page), idx, val);
+}
+#endif /* CONFIG_MEMCG */
+
+static inline void __inc_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_state(lruvec, idx, 1);
+}
+
+static inline void __dec_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_state(lruvec, idx, -1);
+}
+
+static inline void __inc_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_page_state(page, idx, 1);
+}
+
+static inline void __dec_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_page_state(page, idx, -1);
+}
+
+static inline void inc_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ mod_lruvec_state(lruvec, idx, 1);
+}
+
+static inline void dec_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ mod_lruvec_state(lruvec, idx, -1);
+}
+
+static inline void inc_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ mod_lruvec_page_state(page, idx, 1);
+}
+
+static inline void dec_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ mod_lruvec_page_state(page, idx, -1);
+}
+
#endif /* _LINUX_VMSTAT_H */

2017-06-16 19:14:55

by Andrew Morton

[permalink] [raw]
Subject: Re: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

On Fri, 16 Jun 2017 14:49:51 -0400 Johannes Weiner <[email protected]> wrote:

> On Wed, Jun 14, 2017 at 12:26:46AM -0700, Guenter Roeck wrote:
> > Hi,
> >
> > I see the following build error in -next when building hexagon images.
> >
> > CC arch/hexagon/kernel/asm-offsets.s
> > In file included from ./include/linux/memcontrol.h:30:0,
> > from ./include/linux/swap.h:8,
> > from ./arch/hexagon/include/asm/pgtable.h:27,
> > from ./include/linux/mm.h:70,
> > from arch/hexagon/kernel/asm-offsets.c:28:
> > ./include/linux/vmstat.h: In function '__inc_zone_page_state':
> > ./include/linux/vmstat.h:294:2: error: implicit declaration of function 'page_zone' [-Werror=implicit-function-declaration]
> > ./include/linux/vmstat.h:294:2: warning: passing argument 1 of '__inc_zone_state' makes pointer from integer without a cast [enabled by default]
> > ./include/linux/vmstat.h:267:20: note: expected 'struct zone *' but argument is of type 'int'
>
> vmstat.h depends on definitions in mm.h, but mm.h through the above
> chain includes vmstat.h first. It worked in my x86 test because x86
> pgtable.h doesn't include swap.h.
>
> The headers are a bit of a mess. memcontrol.h is supposed to be a
> lower level header than mm.h and vmstat.h, yet the new accounting
> functions depend on mm.h definitions.
>
> Let's move the lruvec accounting infra to vmstat.h and shuffle
> memcontrol.h into the stack under mm.h and vmstat.h.
>
> Does the following fix the hexagon build?

This breaks x86_64 allnoconfig.

arch/x86/mm/pat.c:734: error: redefinition of 'arch_io_reserve_memtype_wc'
./include/linux/io.h:175: note: previous definition of 'arch_io_reserve_memtype_wc' was here
arch/x86/mm/pat.c:742: error: redefinition of 'arch_io_free_memtype_wc'
./include/linux/io.h:181: note: previous definition of 'arch_io_free_memtype_wc' was here

2017-06-16 20:15:30

by Johannes Weiner

[permalink] [raw]
Subject: Re: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

On Fri, Jun 16, 2017 at 12:14:53PM -0700, Andrew Morton wrote:
> On Fri, 16 Jun 2017 14:49:51 -0400 Johannes Weiner <[email protected]> wrote:
>
> > On Wed, Jun 14, 2017 at 12:26:46AM -0700, Guenter Roeck wrote:
> > > Hi,
> > >
> > > I see the following build error in -next when building hexagon images.
> > >
> > > CC arch/hexagon/kernel/asm-offsets.s
> > > In file included from ./include/linux/memcontrol.h:30:0,
> > > from ./include/linux/swap.h:8,
> > > from ./arch/hexagon/include/asm/pgtable.h:27,
> > > from ./include/linux/mm.h:70,
> > > from arch/hexagon/kernel/asm-offsets.c:28:
> > > ./include/linux/vmstat.h: In function '__inc_zone_page_state':
> > > ./include/linux/vmstat.h:294:2: error: implicit declaration of function 'page_zone' [-Werror=implicit-function-declaration]
> > > ./include/linux/vmstat.h:294:2: warning: passing argument 1 of '__inc_zone_state' makes pointer from integer without a cast [enabled by default]
> > > ./include/linux/vmstat.h:267:20: note: expected 'struct zone *' but argument is of type 'int'
> >
> > vmstat.h depends on definitions in mm.h, but mm.h through the above
> > chain includes vmstat.h first. It worked in my x86 test because x86
> > pgtable.h doesn't include swap.h.
> >
> > The headers are a bit of a mess. memcontrol.h is supposed to be a
> > lower level header than mm.h and vmstat.h, yet the new accounting
> > functions depend on mm.h definitions.
> >
> > Let's move the lruvec accounting infra to vmstat.h and shuffle
> > memcontrol.h into the stack under mm.h and vmstat.h.
> >
> > Does the following fix the hexagon build?
>
> This breaks x86_64 allnoconfig.
>
> arch/x86/mm/pat.c:734: error: redefinition of 'arch_io_reserve_memtype_wc'
> ./include/linux/io.h:175: note: previous definition of 'arch_io_reserve_memtype_wc' was here
> arch/x86/mm/pat.c:742: error: redefinition of 'arch_io_free_memtype_wc'
> ./include/linux/io.h:181: note: previous definition of 'arch_io_free_memtype_wc' was here

wat:

/home/hannes/src/linux/linux/arch/x86/mm/pat.c:734:5: error: redefinition of ‘arch_io_reserve_memtype_wc’
int arch_io_reserve_memtype_wc(resource_size_t start, resource_size_t size)
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/hannes/src/linux/linux/include/linux/irq.h:24:0,
from /home/hannes/src/linux/linux/arch/x86/include/asm/hardirq.h:5,
from /home/hannes/src/linux/linux/include/linux/hardirq.h:8,
from /home/hannes/src/linux/linux/include/linux/memcontrol.h:24,
from /home/hannes/src/linux/linux/include/linux/vmstat.h:9,
from /home/hannes/src/linux/linux/include/linux/mm.h:1032,
from /home/hannes/src/linux/linux/include/linux/pfn_t.h:3,
from /home/hannes/src/linux/linux/arch/x86/mm/pat.c:15:
/home/hannes/src/linux/linux/include/linux/io.h:175:19: note: previous definition of ‘arch_io_reserve_memtype_wc’ was here
static inline int arch_io_reserve_memtype_wc(resource_size_t base,
^~~~~~~~~~~~~~~~~~~~~~~~~~

In any case, memcontrol.h doesn't/shouldn't need hardirq.h. When that
include is removed, the below patch compiles on: x86 allno, x86_64
allno, and my regular x86_64 config:

---
Subject: mm-memcontrol-per-lruvec-stats-infrastructure-fix-4

On Wed, Jun 14, 2017 at 12:26:46AM -0700, Guenter Roeck wrote:
> Hi,
>
> I see the following build error in -next when building hexagon images.
>
> CC arch/hexagon/kernel/asm-offsets.s
> In file included from ./include/linux/memcontrol.h:30:0,
> from ./include/linux/swap.h:8,
> from ./arch/hexagon/include/asm/pgtable.h:27,
> from ./include/linux/mm.h:70,
> from arch/hexagon/kernel/asm-offsets.c:28:
> ./include/linux/vmstat.h: In function '__inc_zone_page_state':
> ./include/linux/vmstat.h:294:2: error: implicit declaration of function 'page_zone' [-Werror=implicit-function-declaration]
> ./include/linux/vmstat.h:294:2: warning: passing argument 1 of '__inc_zone_state' makes pointer from integer without a cast [enabled by default]
> ./include/linux/vmstat.h:267:20: note: expected 'struct zone *' but argument is of type 'int'

vmstat.h depends on definitions in mm.h, but mm.h through the above
chain includes vmstat.h first. It worked in my x86 test because x86
pgtable.h doesn't include swap.h.

The headers are a bit of a mess. memcontrol.h is supposed to be a
lower level header than mm.h and vmstat.h, yet the new accounting
functions depend on mm.h definitions.

Let's move the lruvec accounting infra to vmstat.h and shuffle
memcontrol.h into the stack under mm.h and vmstat.h.

Reported-by: Guenter Roeck <[email protected]>
Signed-off-by: Johannes Weiner <[email protected]>
---

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index da9360885260..b5a60c0bcb73 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -21,13 +21,10 @@
#define _LINUX_MEMCONTROL_H
#include <linux/cgroup.h>
#include <linux/vm_event_item.h>
-#include <linux/hardirq.h>
#include <linux/jump_label.h>
#include <linux/page_counter.h>
#include <linux/vmpressure.h>
#include <linux/eventfd.h>
-#include <linux/mm.h>
-#include <linux/vmstat.h>
#include <linux/writeback.h>
#include <linux/page-flags.h>

@@ -536,78 +533,6 @@ static inline void mod_memcg_page_state(struct page *page,
mod_memcg_state(page->mem_cgroup, idx, val);
}

-static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- struct mem_cgroup_per_node *pn;
- long val = 0;
- int cpu;
-
- if (mem_cgroup_disabled())
- return node_page_state(lruvec_pgdat(lruvec), idx);
-
- pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
- for_each_possible_cpu(cpu)
- val += per_cpu(pn->lruvec_stat->count[idx], cpu);
-
- if (val < 0)
- val = 0;
-
- return val;
-}
-
-static inline void __mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
- if (mem_cgroup_disabled())
- return;
- pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
- __mod_memcg_state(pn->memcg, idx, val);
- __this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
-static inline void mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
- if (mem_cgroup_disabled())
- return;
- pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
- mod_memcg_state(pn->memcg, idx, val);
- this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
-static inline void __mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- __mod_node_page_state(page_pgdat(page), idx, val);
- if (mem_cgroup_disabled() || !page->mem_cgroup)
- return;
- __mod_memcg_state(page->mem_cgroup, idx, val);
- pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
- __this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
-static inline void mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- struct mem_cgroup_per_node *pn;
-
- mod_node_page_state(page_pgdat(page), idx, val);
- if (mem_cgroup_disabled() || !page->mem_cgroup)
- return;
- mod_memcg_state(page->mem_cgroup, idx, val);
- pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
- this_cpu_add(pn->lruvec_stat->count[idx], val);
-}
-
unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
gfp_t gfp_mask,
unsigned long *total_scanned);
@@ -835,36 +760,6 @@ static inline void mod_memcg_page_state(struct page *page,
{
}

-static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- return node_page_state(lruvec_pgdat(lruvec), idx);
-}
-
-static inline void __mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
-}
-
-static inline void mod_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx, int val)
-{
- mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
-}
-
-static inline void __mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- __mod_node_page_state(page_pgdat(page), idx, val);
-}
-
-static inline void mod_lruvec_page_state(struct page *page,
- enum node_stat_item idx, int val)
-{
- mod_node_page_state(page_pgdat(page), idx, val);
-}
-
static inline
unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
gfp_t gfp_mask,
@@ -907,30 +802,6 @@ static inline void __dec_memcg_page_state(struct page *page,
__mod_memcg_page_state(page, idx, -1);
}

-static inline void __inc_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- __mod_lruvec_state(lruvec, idx, 1);
-}
-
-static inline void __dec_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- __mod_lruvec_state(lruvec, idx, -1);
-}
-
-static inline void __inc_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- __mod_lruvec_page_state(page, idx, 1);
-}
-
-static inline void __dec_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- __mod_lruvec_page_state(page, idx, -1);
-}
-
static inline void inc_memcg_state(struct mem_cgroup *memcg,
enum memcg_stat_item idx)
{
@@ -955,30 +826,6 @@ static inline void dec_memcg_page_state(struct page *page,
mod_memcg_page_state(page, idx, -1);
}

-static inline void inc_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- mod_lruvec_state(lruvec, idx, 1);
-}
-
-static inline void dec_lruvec_state(struct lruvec *lruvec,
- enum node_stat_item idx)
-{
- mod_lruvec_state(lruvec, idx, -1);
-}
-
-static inline void inc_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- mod_lruvec_page_state(page, idx, 1);
-}
-
-static inline void dec_lruvec_page_state(struct page *page,
- enum node_stat_item idx)
-{
- mod_lruvec_page_state(page, idx, -1);
-}
-
#ifdef CONFIG_CGROUP_WRITEBACK

struct list_head *mem_cgroup_cgwb_list(struct mem_cgroup *memcg);
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index b3d85f30d424..4c52a9f7b6a4 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -6,6 +6,7 @@
#include <linux/mmzone.h>
#include <linux/vm_event_item.h>
#include <linux/atomic.h>
+#include <linux/memcontrol.h>

extern int sysctl_stat_interval;

@@ -350,4 +351,156 @@ static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages,

extern const char * const vmstat_text[];

+#ifdef CONFIG_MEMCG
+static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ struct mem_cgroup_per_node *pn;
+ long val = 0;
+ int cpu;
+
+ if (mem_cgroup_disabled())
+ return node_page_state(lruvec_pgdat(lruvec), idx);
+
+ pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
+ for_each_possible_cpu(cpu)
+ val += per_cpu(pn->lruvec_stat->count[idx], cpu);
+
+ if (val < 0)
+ val = 0;
+
+ return val;
+}
+
+static inline void __mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+ if (mem_cgroup_disabled())
+ return;
+ pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
+ __mod_memcg_state(pn->memcg, idx, val);
+ __this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+
+static inline void mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+ if (mem_cgroup_disabled())
+ return;
+ pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
+ mod_memcg_state(pn->memcg, idx, val);
+ this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+
+static inline void __mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ __mod_node_page_state(page_pgdat(page), idx, val);
+ if (mem_cgroup_disabled() || !page->mem_cgroup)
+ return;
+ __mod_memcg_state(page->mem_cgroup, idx, val);
+ pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
+ __this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+
+static inline void mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ struct mem_cgroup_per_node *pn;
+
+ mod_node_page_state(page_pgdat(page), idx, val);
+ if (mem_cgroup_disabled() || !page->mem_cgroup)
+ return;
+ mod_memcg_state(page->mem_cgroup, idx, val);
+ pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
+ this_cpu_add(pn->lruvec_stat->count[idx], val);
+}
+#else /* CONFIG_MEMCG */
+static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ return node_page_state(lruvec_pgdat(lruvec), idx);
+}
+
+static inline void __mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+}
+
+static inline void mod_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx, int val)
+{
+ mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
+}
+
+static inline void __mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ __mod_node_page_state(page_pgdat(page), idx, val);
+}
+
+static inline void mod_lruvec_page_state(struct page *page,
+ enum node_stat_item idx, int val)
+{
+ mod_node_page_state(page_pgdat(page), idx, val);
+}
+#endif /* CONFIG_MEMCG */
+
+static inline void __inc_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_state(lruvec, idx, 1);
+}
+
+static inline void __dec_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_state(lruvec, idx, -1);
+}
+
+static inline void __inc_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_page_state(page, idx, 1);
+}
+
+static inline void __dec_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ __mod_lruvec_page_state(page, idx, -1);
+}
+
+static inline void inc_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ mod_lruvec_state(lruvec, idx, 1);
+}
+
+static inline void dec_lruvec_state(struct lruvec *lruvec,
+ enum node_stat_item idx)
+{
+ mod_lruvec_state(lruvec, idx, -1);
+}
+
+static inline void inc_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ mod_lruvec_page_state(page, idx, 1);
+}
+
+static inline void dec_lruvec_page_state(struct page *page,
+ enum node_stat_item idx)
+{
+ mod_lruvec_page_state(page, idx, -1);
+}
+
#endif /* _LINUX_VMSTAT_H */

2017-06-16 20:37:23

by Andrew Morton

[permalink] [raw]
Subject: Re: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

On Fri, 16 Jun 2017 16:15:23 -0400 Johannes Weiner <[email protected]> wrote:

> In any case, memcontrol.h doesn't/shouldn't need hardirq.h. When that
> include is removed, the below patch compiles on: x86 allno, x86_64
> allno, and my regular x86_64 config:
>
> ---
> Subject: mm-memcontrol-per-lruvec-stats-infrastructure-fix-4

Did you try x86_64 allmodconfig? I'm getting a mess:

In file included from ./include/linux/mm.h:1032,
from ./include/linux/highmem.h:7,
from ./include/linux/bio.h:21,
from ./include/linux/writeback.h:205,
from ./include/linux/memcontrol.h:28,
from ./include/linux/swap.h:8,
from ./include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
./include/linux/vmstat.h: In function 'lruvec_page_state':
./include/linux/vmstat.h:362: error: implicit declaration of function 'mem_cgroup_disabled'
./include/linux/vmstat.h:365: error: dereferencing pointer to incomplete type
./include/linux/vmstat.h:365: error: type defaults to 'int' in declaration of 'type name'
...

Presumably because we have memcontrol.h indirectly including mm.h which
includes vmstat.h (from a stupid place) and with this patch we have
vmstat.h including memcontrol.h.

2017-06-17 15:37:26

by Guenter Roeck

[permalink] [raw]
Subject: Re: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

On Fri, Jun 16, 2017 at 01:37:21PM -0700, wrote:
> On Fri, 16 Jun 2017 16:15:23 -0400 Johannes Weiner <[email protected]> wrote:
>
> > In any case, memcontrol.h doesn't/shouldn't need hardirq.h. When that
> > include is removed, the below patch compiles on: x86 allno, x86_64
> > allno, and my regular x86_64 config:
> >
> > ---
> > Subject: mm-memcontrol-per-lruvec-stats-infrastructure-fix-4
>
> Did you try x86_64 allmodconfig? I'm getting a mess:
>
> In file included from ./include/linux/mm.h:1032,
> from ./include/linux/highmem.h:7,
> from ./include/linux/bio.h:21,
> from ./include/linux/writeback.h:205,
> from ./include/linux/memcontrol.h:28,
> from ./include/linux/swap.h:8,
> from ./include/linux/suspend.h:4,
> from arch/x86/kernel/asm-offsets.c:12:
> ./include/linux/vmstat.h: In function 'lruvec_page_state':
> ./include/linux/vmstat.h:362: error: implicit declaration of function 'mem_cgroup_disabled'
> ./include/linux/vmstat.h:365: error: dereferencing pointer to incomplete type
> ./include/linux/vmstat.h:365: error: type defaults to 'int' in declaration of 'type name'
> ...
>
> Presumably because we have memcontrol.h indirectly including mm.h which
> includes vmstat.h (from a stupid place) and with this patch we have
> vmstat.h including memcontrol.h.
>

How about the following ? Seems to be less invasive, and it fixes the
immediate problem.

Guenter

---
>From 3aa278a36b5f71ff64b28e0cea05182fbcaa72e6 Mon Sep 17 00:00:00 2001
From: Guenter Roeck <[email protected]>
Date: Sat, 17 Jun 2017 08:15:57 -0700
Subject: [PATCH] hexagon: Fix build error caused by include file order

hexagon builds fail with the following error message.
In file included from ./include/linux/memcontrol.h:30:0,
from ./include/linux/swap.h:8,
from ./arch/hexagon/include/asm/pgtable.h:27,
from ./include/linux/mm.h:70,
from arch/hexagon/kernel/asm-offsets.c:28:
./include/linux/vmstat.h: In function '__inc_zone_page_state':
./include/linux/vmstat.h:294:2: error:
implicit declaration of function 'page_zone'

Drop unnecessary includes from header files and add missing
includes to source files to fix the problem.

Cc: Johannes Weiner <[email protected]>
Cc: Andrew Morton <[email protected]>
Fixes: fb6646f52c45 ("mm: memcontrol: per-lruvec stats infrastructure")
Signed-off-by: Guenter Roeck <[email protected]>
---
arch/hexagon/include/asm/pgtable.h | 1 -
arch/hexagon/kernel/asm-offsets.c | 1 -
arch/hexagon/mm/vm_tlb.c | 1 +
3 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h
index 24a9177fb897..aef02f7ca8aa 100644
--- a/arch/hexagon/include/asm/pgtable.h
+++ b/arch/hexagon/include/asm/pgtable.h
@@ -24,7 +24,6 @@
/*
* Page table definitions for Qualcomm Hexagon processor.
*/
-#include <linux/swap.h>
#include <asm/page.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h>
diff --git a/arch/hexagon/kernel/asm-offsets.c b/arch/hexagon/kernel/asm-offsets.c
index 308be68d4fb3..3980c0407aa1 100644
--- a/arch/hexagon/kernel/asm-offsets.c
+++ b/arch/hexagon/kernel/asm-offsets.c
@@ -25,7 +25,6 @@
#include <linux/compat.h>
#include <linux/types.h>
#include <linux/sched.h>
-#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/kbuild.h>
#include <asm/ptrace.h>
diff --git a/arch/hexagon/mm/vm_tlb.c b/arch/hexagon/mm/vm_tlb.c
index 9647d00cb761..b474065533ce 100644
--- a/arch/hexagon/mm/vm_tlb.c
+++ b/arch/hexagon/mm/vm_tlb.c
@@ -24,6 +24,7 @@
* be instantiated for it, differently from a native build.
*/
#include <linux/mm.h>
+#include <linux/sched.h>
#include <asm/page.h>
#include <asm/hexagon_vm.h>

--
2.7.4

2017-06-17 15:41:01

by Guenter Roeck

[permalink] [raw]
Subject: Re: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

[resending; somehow Andrew got lost in my first reply]

On Fri, Jun 16, 2017 at 01:37:21PM -0700, Andrew Morton wrote:
> On Fri, 16 Jun 2017 16:15:23 -0400 Johannes Weiner <[email protected]> wrote:
>
> > In any case, memcontrol.h doesn't/shouldn't need hardirq.h. When that
> > include is removed, the below patch compiles on: x86 allno, x86_64
> > allno, and my regular x86_64 config:
> >
> > ---
> > Subject: mm-memcontrol-per-lruvec-stats-infrastructure-fix-4
>
> Did you try x86_64 allmodconfig? I'm getting a mess:
>
> In file included from ./include/linux/mm.h:1032,
> from ./include/linux/highmem.h:7,
> from ./include/linux/bio.h:21,
> from ./include/linux/writeback.h:205,
> from ./include/linux/memcontrol.h:28,
> from ./include/linux/swap.h:8,
> from ./include/linux/suspend.h:4,
> from arch/x86/kernel/asm-offsets.c:12:
> ./include/linux/vmstat.h: In function 'lruvec_page_state':
> ./include/linux/vmstat.h:362: error: implicit declaration of function 'mem_cgroup_disabled'
> ./include/linux/vmstat.h:365: error: dereferencing pointer to incomplete type
> ./include/linux/vmstat.h:365: error: type defaults to 'int' in declaration of 'type name'
> ...
>
> Presumably because we have memcontrol.h indirectly including mm.h which
> includes vmstat.h (from a stupid place) and with this patch we have
> vmstat.h including memcontrol.h.
>

How about the following ? Seems to be less invasive, and it fixes the
immediate problem.

Guenter

---
>From 3aa278a36b5f71ff64b28e0cea05182fbcaa72e6 Mon Sep 17 00:00:00 2001
From: Guenter Roeck <[email protected]>
Date: Sat, 17 Jun 2017 08:15:57 -0700
Subject: [PATCH] hexagon: Fix build error caused by include file order

hexagon builds fail with the following error message.
In file included from ./include/linux/memcontrol.h:30:0,
from ./include/linux/swap.h:8,
from ./arch/hexagon/include/asm/pgtable.h:27,
from ./include/linux/mm.h:70,
from arch/hexagon/kernel/asm-offsets.c:28:
./include/linux/vmstat.h: In function '__inc_zone_page_state':
./include/linux/vmstat.h:294:2: error:
implicit declaration of function 'page_zone'

Drop unnecessary includes from header files and add missing
includes to source files to fix the problem.

Cc: Johannes Weiner <[email protected]>
Cc: Andrew Morton <[email protected]>
Fixes: fb6646f52c45 ("mm: memcontrol: per-lruvec stats infrastructure")
Signed-off-by: Guenter Roeck <[email protected]>
---
arch/hexagon/include/asm/pgtable.h | 1 -
arch/hexagon/kernel/asm-offsets.c | 1 -
arch/hexagon/mm/vm_tlb.c | 1 +
3 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h
index 24a9177fb897..aef02f7ca8aa 100644
--- a/arch/hexagon/include/asm/pgtable.h
+++ b/arch/hexagon/include/asm/pgtable.h
@@ -24,7 +24,6 @@
/*
* Page table definitions for Qualcomm Hexagon processor.
*/
-#include <linux/swap.h>
#include <asm/page.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h>
diff --git a/arch/hexagon/kernel/asm-offsets.c b/arch/hexagon/kernel/asm-offsets.c
index 308be68d4fb3..3980c0407aa1 100644
--- a/arch/hexagon/kernel/asm-offsets.c
+++ b/arch/hexagon/kernel/asm-offsets.c
@@ -25,7 +25,6 @@
#include <linux/compat.h>
#include <linux/types.h>
#include <linux/sched.h>
-#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/kbuild.h>
#include <asm/ptrace.h>
diff --git a/arch/hexagon/mm/vm_tlb.c b/arch/hexagon/mm/vm_tlb.c
index 9647d00cb761..b474065533ce 100644
--- a/arch/hexagon/mm/vm_tlb.c
+++ b/arch/hexagon/mm/vm_tlb.c
@@ -24,6 +24,7 @@
* be instantiated for it, differently from a native build.
*/
#include <linux/mm.h>
+#include <linux/sched.h>
#include <asm/page.h>
#include <asm/hexagon_vm.h>

--
2.7.4


2017-06-17 18:12:08

by kernel test robot

[permalink] [raw]
Subject: Re: mm-memcontrol-per-lruvec-stats-infrastructure-fix-4

Hi Johannes,

[auto build test ERROR on next-20170616]
[cannot apply to linus/master linux/master v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.12-rc5]
[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/Johannes-Weiner/mm-memcontrol-per-lruvec-stats-infrastructure-fix-4/20170618-012558
config: x86_64-randconfig-i0-201725 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

scripts/Makefile.kasan:25: CONFIG_KASAN: compiler does not support all options. Trying minimal configuration
scripts/Makefile.kasan:25: CONFIG_KASAN: compiler does not support all options. Trying minimal configuration
In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/vmstat.h: In function 'lruvec_page_state':
include/linux/vmstat.h:362:2: error: implicit declaration of function 'mem_cgroup_disabled' [-Werror=implicit-function-declaration]
if (mem_cgroup_disabled())
^
In file included from arch/x86/include/asm/atomic.h:4:0,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/kernel.h:859:51: error: dereferencing pointer to incomplete type
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/compiler.h:517:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^
include/linux/compiler.h:537:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/kernel.h:859:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/kernel.h:859:20: note: in expansion of macro '__same_type'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/vmstat.h:365:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
In file included from include/linux/compiler.h:58:0,
from arch/x86/include/asm/atomic.h:4,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h:365:35: error: invalid use of undefined type 'struct mem_cgroup_per_node'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
include/linux/compiler-gcc.h:161:21: note: in definition of macro '__compiler_offsetof'
__builtin_offsetof(a, b)
^
include/linux/kernel.h:862:28: note: in expansion of macro 'offsetof'
((type *)((char *)(ptr) - offsetof(type, member))); })
^
include/linux/vmstat.h:365:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
In file included from include/asm-generic/percpu.h:6:0,
from arch/x86/include/asm/percpu.h:542,
from arch/x86/include/asm/preempt.h:5,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
>> include/linux/vmstat.h:367:20: error: dereferencing pointer to incomplete type
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
include/linux/percpu-defs.h:206:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^
include/linux/percpu-defs.h:256:29: note: in expansion of macro 'per_cpu_ptr'
#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
^
>> include/linux/vmstat.h:367:10: note: in expansion of macro 'per_cpu'
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
In file included from include/linux/compiler.h:58:0,
from arch/x86/include/asm/atomic.h:4,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
>> include/linux/vmstat.h:367:20: error: dereferencing pointer to incomplete type
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
include/linux/compiler-gcc.h:52:34: note: in definition of macro 'RELOC_HIDE'
__asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
^
include/linux/percpu-defs.h:223:2: note: in expansion of macro 'SHIFT_PERCPU_PTR'
SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
^
include/linux/percpu-defs.h:256:29: note: in expansion of macro 'per_cpu_ptr'
#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
^
>> include/linux/vmstat.h:367:10: note: in expansion of macro 'per_cpu'
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
>> include/linux/vmstat.h:367:20: error: dereferencing pointer to incomplete type
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
include/linux/compiler-gcc.h:52:34: note: in definition of macro 'RELOC_HIDE'
__asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
^
include/linux/percpu-defs.h:223:2: note: in expansion of macro 'SHIFT_PERCPU_PTR'
SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
^
include/linux/percpu-defs.h:256:29: note: in expansion of macro 'per_cpu_ptr'
#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
^
>> include/linux/vmstat.h:367:10: note: in expansion of macro 'per_cpu'
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
>> include/linux/vmstat.h:367:20: error: dereferencing pointer to incomplete type
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
include/linux/compiler-gcc.h:53:10: note: in definition of macro 'RELOC_HIDE'
(typeof(ptr)) (__ptr + (off)); \
^
include/linux/percpu-defs.h:223:2: note: in expansion of macro 'SHIFT_PERCPU_PTR'
SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
^
include/linux/percpu-defs.h:256:29: note: in expansion of macro 'per_cpu_ptr'
#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
^
>> include/linux/vmstat.h:367:10: note: in expansion of macro 'per_cpu'
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
>> include/linux/vmstat.h:367:20: error: dereferencing pointer to incomplete type
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
include/linux/compiler-gcc.h:53:10: note: in definition of macro 'RELOC_HIDE'
(typeof(ptr)) (__ptr + (off)); \
^
include/linux/percpu-defs.h:223:2: note: in expansion of macro 'SHIFT_PERCPU_PTR'
SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \
^
include/linux/percpu-defs.h:256:29: note: in expansion of macro 'per_cpu_ptr'
#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
^
>> include/linux/vmstat.h:367:10: note: in expansion of macro 'per_cpu'
val += per_cpu(pn->lruvec_stat->count[idx], cpu);
^
In file included from arch/x86/include/asm/atomic.h:4:0,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h: In function '__mod_lruvec_state':
include/linux/kernel.h:859:51: error: dereferencing pointer to incomplete type
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/compiler.h:517:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^
include/linux/compiler.h:537:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/kernel.h:859:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/kernel.h:859:20: note: in expansion of macro '__same_type'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/vmstat.h:383:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
In file included from include/linux/compiler.h:58:0,
from arch/x86/include/asm/atomic.h:4,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h:383:35: error: invalid use of undefined type 'struct mem_cgroup_per_node'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
include/linux/compiler-gcc.h:161:21: note: in definition of macro '__compiler_offsetof'
__builtin_offsetof(a, b)
^
include/linux/kernel.h:862:28: note: in expansion of macro 'offsetof'
((type *)((char *)(ptr) - offsetof(type, member))); })
^
include/linux/vmstat.h:383:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/vmstat.h:384:2: error: implicit declaration of function '__mod_memcg_state' [-Werror=implicit-function-declaration]
__mod_memcg_state(pn->memcg, idx, val);
^
include/linux/vmstat.h:384:22: error: dereferencing pointer to incomplete type
__mod_memcg_state(pn->memcg, idx, val);
^
In file included from include/asm-generic/percpu.h:6:0,
from arch/x86/include/asm/percpu.h:542,
from arch/x86/include/asm/preempt.h:5,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/percpu-defs.h:206:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/percpu-defs.h:363:16: note: in definition of macro '__pcpu_size_call'
switch(sizeof(variable)) { \
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
In file included from arch/x86/include/asm/preempt.h:5:0,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:128:17: note: in definition of macro 'percpu_add_op'
typedef typeof(var) pao_T__; \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:137:17: note: in definition of macro 'percpu_add_op'
switch (sizeof(var)) { \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:140:39: note: in definition of macro 'percpu_add_op'
asm("incb "__percpu_arg(0) : "+m" (var)); \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:142:39: note: in definition of macro 'percpu_add_op'
asm("decb "__percpu_arg(0) : "+m" (var)); \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:145:16: note: in definition of macro 'percpu_add_op'
: "+m" (var) \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:150:39: note: in definition of macro 'percpu_add_op'
asm("incw "__percpu_arg(0) : "+m" (var)); \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:152:39: note: in definition of macro 'percpu_add_op'
asm("decw "__percpu_arg(0) : "+m" (var)); \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:155:16: note: in definition of macro 'percpu_add_op'
: "+m" (var) \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:160:39: note: in definition of macro 'percpu_add_op'
asm("incl "__percpu_arg(0) : "+m" (var)); \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:162:39: note: in definition of macro 'percpu_add_op'
asm("decl "__percpu_arg(0) : "+m" (var)); \
^
>> include/linux/percpu-defs.h:364:11: note: in expansion of macro 'raw_cpu_add_1'
case 1: stem##1(variable, __VA_ARGS__);break; \
^
include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^
include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^
include/linux/vmstat.h:385:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/vmstat.h:385:19: error: dereferencing pointer to incomplete type
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
arch/x86/include/asm/percpu.h:165:16: note: in definition of macro 'percpu_add_op'
: "+m" (var) \
^

vim +367 include/linux/vmstat.h

361
362 if (mem_cgroup_disabled())
363 return node_page_state(lruvec_pgdat(lruvec), idx);
364
365 pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
366 for_each_possible_cpu(cpu)
> 367 val += per_cpu(pn->lruvec_stat->count[idx], cpu);
368
369 if (val < 0)
370 val = 0;

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


Attachments:
(No filename) (23.73 kB)
.config.gz (26.64 kB)
Download all attachments

2017-06-17 18:28:11

by kernel test robot

[permalink] [raw]
Subject: Re: mm-memcontrol-per-lruvec-stats-infrastructure-fix-4

Hi Johannes,

[auto build test ERROR on next-20170616]
[cannot apply to linus/master linux/master v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.12-rc5]
[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/Johannes-Weiner/mm-memcontrol-per-lruvec-stats-infrastructure-fix-4/20170618-012558
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.3.0-18) 6.3.0 20170516
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/vmstat.h: In function 'lruvec_page_state':
>> include/linux/vmstat.h:362:6: error: implicit declaration of function 'mem_cgroup_disabled' [-Werror=implicit-function-declaration]
if (mem_cgroup_disabled())
^~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/atomic.h:4:0,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
>> include/linux/kernel.h:859:51: error: dereferencing pointer to incomplete type 'struct mem_cgroup_per_node'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/compiler.h:517:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^~~~~~~~~
include/linux/compiler.h:537:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:859:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~~~~~~
include/linux/kernel.h:859:20: note: in expansion of macro '__same_type'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~
>> include/linux/vmstat.h:365:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^~~~~~~~~~~~
In file included from include/linux/compiler.h:58:0,
from arch/x86/include/asm/atomic.h:4,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
>> include/linux/vmstat.h:365:35: error: invalid use of undefined type 'struct mem_cgroup_per_node'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
include/linux/compiler-gcc.h:161:21: note: in definition of macro '__compiler_offsetof'
__builtin_offsetof(a, b)
^
include/linux/kernel.h:862:28: note: in expansion of macro 'offsetof'
((type *)((char *)(ptr) - offsetof(type, member))); })
^~~~~~~~
>> include/linux/vmstat.h:365:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^~~~~~~~~~~~
In file included from arch/x86/include/asm/atomic.h:4:0,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h: In function '__mod_lruvec_state':
>> include/linux/kernel.h:859:51: error: dereferencing pointer to incomplete type 'struct mem_cgroup_per_node'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/compiler.h:517:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^~~~~~~~~
include/linux/compiler.h:537:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:859:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~~~~~~
include/linux/kernel.h:859:20: note: in expansion of macro '__same_type'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~
include/linux/vmstat.h:383:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^~~~~~~~~~~~
In file included from include/linux/compiler.h:58:0,
from arch/x86/include/asm/atomic.h:4,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h:383:35: error: invalid use of undefined type 'struct mem_cgroup_per_node'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
include/linux/compiler-gcc.h:161:21: note: in definition of macro '__compiler_offsetof'
__builtin_offsetof(a, b)
^
include/linux/kernel.h:862:28: note: in expansion of macro 'offsetof'
((type *)((char *)(ptr) - offsetof(type, member))); })
^~~~~~~~
include/linux/vmstat.h:383:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^~~~~~~~~~~~
In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/vmstat.h:384:2: error: implicit declaration of function '__mod_memcg_state' [-Werror=implicit-function-declaration]
__mod_memcg_state(pn->memcg, idx, val);
^~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/atomic.h:4:0,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h: In function 'mod_lruvec_state':
>> include/linux/kernel.h:859:51: error: dereferencing pointer to incomplete type 'struct mem_cgroup_per_node'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/compiler.h:517:19: note: in definition of macro '__compiletime_assert'
bool __cond = !(condition); \
^~~~~~~~~
include/linux/compiler.h:537:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:859:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~~~~~~
include/linux/kernel.h:859:20: note: in expansion of macro '__same_type'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~
include/linux/vmstat.h:396:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^~~~~~~~~~~~
In file included from include/linux/compiler.h:58:0,
from arch/x86/include/asm/atomic.h:4,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/vmstat.h:396:35: error: invalid use of undefined type 'struct mem_cgroup_per_node'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^
include/linux/compiler-gcc.h:161:21: note: in definition of macro '__compiler_offsetof'
__builtin_offsetof(a, b)
^
include/linux/kernel.h:862:28: note: in expansion of macro 'offsetof'
((type *)((char *)(ptr) - offsetof(type, member))); })
^~~~~~~~
include/linux/vmstat.h:396:7: note: in expansion of macro 'container_of'
pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
^~~~~~~~~~~~
In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/vmstat.h:397:2: error: implicit declaration of function 'mod_memcg_state' [-Werror=implicit-function-declaration]
mod_memcg_state(pn->memcg, idx, val);
^~~~~~~~~~~~~~~
include/linux/vmstat.h: In function '__mod_lruvec_page_state':
>> include/linux/vmstat.h:410:23: error: dereferencing pointer to incomplete type 'struct mem_cgroup'
pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
^~
In file included from include/asm-generic/percpu.h:6:0,
from arch/x86/include/asm/percpu.h:542,
from arch/x86/include/asm/preempt.h:5,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
>> include/linux/vmstat.h:411:19: error: dereferencing pointer to incomplete type 'struct mem_cgroup_per_node'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/percpu-defs.h:206:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^~~
>> include/linux/percpu-defs.h:409:32: note: in expansion of macro '__pcpu_size_call'
#define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val)
^~~~~~~~~~~~~~~~
>> include/linux/percpu-defs.h:445:2: note: in expansion of macro 'raw_cpu_add'
raw_cpu_add(pcp, val); \
^~~~~~~~~~~
include/linux/vmstat.h:411:2: note: in expansion of macro '__this_cpu_add'
__this_cpu_add(pn->lruvec_stat->count[idx], val);
^~~~~~~~~~~~~~
include/linux/vmstat.h: In function 'mod_lruvec_page_state':
include/linux/vmstat.h:424:17: error: dereferencing pointer to incomplete type 'struct mem_cgroup_per_node'
this_cpu_add(pn->lruvec_stat->count[idx], val);
^
include/linux/percpu-defs.h:206:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^~~
include/linux/percpu-defs.h:496:33: note: in expansion of macro '__pcpu_size_call'
#define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val)
^~~~~~~~~~~~~~~~
include/linux/vmstat.h:424:2: note: in expansion of macro 'this_cpu_add'
this_cpu_add(pn->lruvec_stat->count[idx], val);
^~~~~~~~~~~~
In file included from include/linux/swap.h:8:0,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/memcontrol.h: At top level:
>> include/linux/memcontrol.h:267:20: error: conflicting types for 'mem_cgroup_disabled'
static inline bool mem_cgroup_disabled(void)
^~~~~~~~~~~~~~~~~~~
In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/vmstat.h:362:6: note: previous implicit declaration of 'mem_cgroup_disabled' was here
if (mem_cgroup_disabled())
^~~~~~~~~~~~~~~~~~~
In file included from include/linux/swap.h:8:0,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/memcontrol.h:502:20: warning: conflicting types for '__mod_memcg_state'
static inline void __mod_memcg_state(struct mem_cgroup *memcg,
^~~~~~~~~~~~~~~~~
>> include/linux/memcontrol.h:502:20: error: static declaration of '__mod_memcg_state' follows non-static declaration
In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/vmstat.h:384:2: note: previous implicit declaration of '__mod_memcg_state' was here
__mod_memcg_state(pn->memcg, idx, val);
^~~~~~~~~~~~~~~~~
In file included from include/linux/swap.h:8:0,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/memcontrol.h:509:20: warning: conflicting types for 'mod_memcg_state'
static inline void mod_memcg_state(struct mem_cgroup *memcg,
^~~~~~~~~~~~~~~
>> include/linux/memcontrol.h:509:20: error: static declaration of 'mod_memcg_state' follows non-static declaration
In file included from include/linux/mm.h:1032:0,
from include/linux/highmem.h:7,
from include/linux/bio.h:21,
from include/linux/writeback.h:205,
from include/linux/memcontrol.h:28,
from include/linux/swap.h:8,
from include/linux/suspend.h:4,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/vmstat.h:397:2: note: previous implicit declaration of 'mod_memcg_state' was here
mod_memcg_state(pn->memcg, idx, val);
^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2

vim +/mem_cgroup_disabled +362 include/linux/vmstat.h

356 enum node_stat_item idx)
357 {
358 struct mem_cgroup_per_node *pn;
359 long val = 0;
360 int cpu;
361
> 362 if (mem_cgroup_disabled())
363 return node_page_state(lruvec_pgdat(lruvec), idx);
364
> 365 pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
366 for_each_possible_cpu(cpu)
367 val += per_cpu(pn->lruvec_stat->count[idx], cpu);
368
369 if (val < 0)
370 val = 0;
371
372 return val;
373 }
374
375 static inline void __mod_lruvec_state(struct lruvec *lruvec,
376 enum node_stat_item idx, int val)
377 {
378 struct mem_cgroup_per_node *pn;
379
380 __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
381 if (mem_cgroup_disabled())
382 return;
383 pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
> 384 __mod_memcg_state(pn->memcg, idx, val);
385 __this_cpu_add(pn->lruvec_stat->count[idx], val);
386 }
387
388 static inline void mod_lruvec_state(struct lruvec *lruvec,
389 enum node_stat_item idx, int val)
390 {
391 struct mem_cgroup_per_node *pn;
392
393 mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
394 if (mem_cgroup_disabled())
395 return;
396 pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
> 397 mod_memcg_state(pn->memcg, idx, val);
398 this_cpu_add(pn->lruvec_stat->count[idx], val);
399 }
400
401 static inline void __mod_lruvec_page_state(struct page *page,
402 enum node_stat_item idx, int val)
403 {
404 struct mem_cgroup_per_node *pn;
405
406 __mod_node_page_state(page_pgdat(page), idx, val);
407 if (mem_cgroup_disabled() || !page->mem_cgroup)
408 return;
409 __mod_memcg_state(page->mem_cgroup, idx, val);
> 410 pn = page->mem_cgroup->nodeinfo[page_to_nid(page)];
> 411 __this_cpu_add(pn->lruvec_stat->count[idx], val);
412 }
413
414 static inline void mod_lruvec_page_state(struct page *page,

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


Attachments:
(No filename) (17.89 kB)
.config.gz (59.13 kB)
Download all attachments

2017-06-19 15:47:40

by Johannes Weiner

[permalink] [raw]
Subject: Re: hexagon: build error in -next due to 'mm: memcontrol: per-lruvec stats infrastructure'

On Sat, Jun 17, 2017 at 08:37:21AM -0700, Guenter Roeck wrote:
> On Fri, Jun 16, 2017 at 01:37:21PM -0700, wrote:
> > On Fri, 16 Jun 2017 16:15:23 -0400 Johannes Weiner <[email protected]> wrote:
> >
> > > In any case, memcontrol.h doesn't/shouldn't need hardirq.h. When that
> > > include is removed, the below patch compiles on: x86 allno, x86_64
> > > allno, and my regular x86_64 config:
> > >
> > > ---
> > > Subject: mm-memcontrol-per-lruvec-stats-infrastructure-fix-4
> >
> > Did you try x86_64 allmodconfig? I'm getting a mess:
> >
> > In file included from ./include/linux/mm.h:1032,
> > from ./include/linux/highmem.h:7,
> > from ./include/linux/bio.h:21,
> > from ./include/linux/writeback.h:205,
> > from ./include/linux/memcontrol.h:28,
> > from ./include/linux/swap.h:8,
> > from ./include/linux/suspend.h:4,
> > from arch/x86/kernel/asm-offsets.c:12:
> > ./include/linux/vmstat.h: In function 'lruvec_page_state':
> > ./include/linux/vmstat.h:362: error: implicit declaration of function 'mem_cgroup_disabled'
> > ./include/linux/vmstat.h:365: error: dereferencing pointer to incomplete type
> > ./include/linux/vmstat.h:365: error: type defaults to 'int' in declaration of 'type name'
> > ...
> >
> > Presumably because we have memcontrol.h indirectly including mm.h which
> > includes vmstat.h (from a stupid place) and with this patch we have
> > vmstat.h including memcontrol.h.
> >
>
> How about the following ? Seems to be less invasive, and it fixes the
> immediate problem.
>
> Guenter
>
> ---
> From 3aa278a36b5f71ff64b28e0cea05182fbcaa72e6 Mon Sep 17 00:00:00 2001
> From: Guenter Roeck <[email protected]>
> Date: Sat, 17 Jun 2017 08:15:57 -0700
> Subject: [PATCH] hexagon: Fix build error caused by include file order
>
> hexagon builds fail with the following error message.
> In file included from ./include/linux/memcontrol.h:30:0,
> from ./include/linux/swap.h:8,
> from ./arch/hexagon/include/asm/pgtable.h:27,
> from ./include/linux/mm.h:70,
> from arch/hexagon/kernel/asm-offsets.c:28:
> ./include/linux/vmstat.h: In function '__inc_zone_page_state':
> ./include/linux/vmstat.h:294:2: error:
> implicit declaration of function 'page_zone'
>
> Drop unnecessary includes from header files and add missing
> includes to source files to fix the problem.
>
> Cc: Johannes Weiner <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Fixes: fb6646f52c45 ("mm: memcontrol: per-lruvec stats infrastructure")
> Signed-off-by: Guenter Roeck <[email protected]>

If they're not needed, all the better. Thanks!

Acked-by: Johannes Weiner <[email protected]>