Subject: linux-next: build failure after merge of the akpm tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 13 Nov 2020 18:02:39 +1100

Hi all,

After merging the akpm tree, today's linux-next build (i386 defconfig)
failed like this:

mm/secretmem.c: In function 'secretmem_memcg_charge':
mm/secretmem.c:72:4: error: 'struct page' has no member named 'memcg_data'
   72 |   p->memcg_data = page->memcg_data;
      |    ^~
mm/secretmem.c:72:23: error: 'struct page' has no member named 'memcg_data'
   72 |   p->memcg_data = page->memcg_data;
      |                       ^~
mm/secretmem.c: In function 'secretmem_memcg_uncharge':
mm/secretmem.c:86:4: error: 'struct page' has no member named 'memcg_data'
   86 |   p->memcg_data = 0;
      |    ^~

Caused by commit

  5f964602825e ("secretmem: add memcg accounting")

memcg_data only exists when CONFIG_MEMCG is set.

I have applied the following patch for today.

From: Stephen Rothwell <[email-masked]>
Date: Fri, 13 Nov 2020 17:50:30 +1100
Subject: [PATCH] secretmem-add-memcg-accounting-fix2

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 mm/secretmem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/secretmem.c b/mm/secretmem.c
index 5ed6b2070136..3dfdbd85ba00 100644
--- a/mm/secretmem.c
+++ b/mm/secretmem.c
@@ -69,7 +69,9 @@ static int secretmem_memcg_charge(struct page *page, gfp_t gfp, int order)
 	for (i = 1; i < nr_pages; i++) {
 		struct page *p = page + i;
 
+#ifdef CONFIG_MEMCG
 		p->memcg_data = page->memcg_data;
+#endif
 	}
 
 	return 0;
@@ -83,7 +85,9 @@ static void secretmem_memcg_uncharge(struct page *page, int order)
 	for (i = 1; i < nr_pages; i++) {
 		struct page *p = page + i;
 
+#ifdef CONFIG_MEMCG
 		p->memcg_data = 0;
+#endif
 	}
 
 	memcg_kmem_uncharge_page(page, PMD_PAGE_ORDER);
-- 
2.28.0

This unfortunately produced these warnings:

mm/secretmem.c: In function 'secretmem_memcg_charge':
mm/secretmem.c:70:16: warning: unused variable 'p' [-Wunused-variable]
   70 |   struct page *p = page + i;
      |                ^
mm/secretmem.c: In function 'secretmem_memcg_uncharge':
mm/secretmem.c:86:16: warning: unused variable 'p' [-Wunused-variable]
   86 |   struct page *p = page + i;
      |                ^

which I will fix up for the next linux-next release, if necessary.
-- 
Cheers,
Stephen Rothwell