Re: mmotm 2020-05-11-15-43 uploaded (mm/memcontrol.c, huge pages)

2020-05-12 Thread Geert Uytterhoeven
Hi Johannes,

On Tue, May 12, 2020 at 2:20 PM Johannes Weiner  wrote:
> On Mon, May 11, 2020 at 09:41:24PM -0700, Randy Dunlap wrote:
> > On 5/11/20 3:44 PM, Andrew Morton wrote:
> > > The mm-of-the-moment snapshot 2020-05-11-15-43 has been uploaded to
> > >
> > >http://www.ozlabs.org/~akpm/mmotm/
> > >
> > > mmotm-readme.txt says
> > >
> > > README for mm-of-the-moment:
> > >
> > > http://www.ozlabs.org/~akpm/mmotm/
> > >
> > > This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
> > > more than once a week.
> > >
> > > You will need quilt to apply these patches to the latest Linus release 
> > > (5.x
> > > or 5.x-rcY).  The series file is in broken-out.tar.gz and is duplicated in
> > > http://ozlabs.org/~akpm/mmotm/series
> > >
> > > The file broken-out.tar.gz contains two datestamp files: .DATE and
> > > .DATE--mm-dd-hh-mm-ss.  Both contain the string -mm-dd-hh-mm-ss,
> > > followed by the base kernel version against which this patch series is to
> > > be applied.
> > >
> > > This tree is partially included in linux-next.  To see which patches are
> > > included in linux-next, consult the `series' file.  Only the patches
> > > within the #NEXT_PATCHES_START/#NEXT_PATCHES_END markers are included in
> > > linux-next.
> > >
> > >
> > > A full copy of the full kernel tree with the linux-next and mmotm patches
> > > already applied is available through git within an hour of the mmotm
> > > release.  Individual mmotm releases are tagged.  The master branch always
> > > points to the latest release, so it's constantly rebasing.
> > >
> > > https://github.com/hnaz/linux-mm
> > >
> > > The directory http://www.ozlabs.org/~akpm/mmots/ (mm-of-the-second)
> > > contains daily snapshots of the -mm tree.  It is updated more frequently
> > > than mmotm, and is untested.
> > >
> > > A git copy of this tree is also available at
> > >
> > > https://github.com/hnaz/linux-mm
>
> Thanks for the report, Randy.
>
> ---
>
> Randy reports:
>
> > on x86_64:
> >
> > In file included from ../arch/x86/include/asm/atomic.h:5:0,
> >  from ../include/linux/atomic.h:7,
> >  from ../include/linux/page_counter.h:5,
> >  from ../mm/memcontrol.c:25:
> > ../mm/memcontrol.c: In function ‘memcg_stat_show’:
> > ../include/linux/compiler.h:394:38: error: call to 
> > ‘__compiletime_assert_383’ declared with attribute error: BUILD_BUG failed
> >   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> >   ^
> > ../include/linux/compiler.h:375:4: note: in definition of macro 
> > ‘__compiletime_assert’
> > prefix ## suffix();\
> > ^~
> > ../include/linux/compiler.h:394:2: note: in expansion of macro 
> > ‘_compiletime_assert’
> >   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> >   ^~~
> > ../include/linux/build_bug.h:39:37: note: in expansion of macro 
> > ‘compiletime_assert’
> >  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> >  ^~
> > ../include/linux/build_bug.h:59:21: note: in expansion of macro 
> > ‘BUILD_BUG_ON_MSG’
> >  #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
> >  ^~~~
> > ../include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
> >  #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
>
> The THP page size macros are CONFIG_TRANSPARENT_HUGEPAGE only.
>
> We already ifdef most THP-related code in memcg, but not these
> particular stats. Memcg used to track the pages as they came in, and
> PageTransHuge() + hpage_nr_pages() work when THP is not compiled in.
>
> Switching to native vmstat counters, memcg doesn't see the pages, it
> only gets a count of THPs. To translate that to bytes, it has to know
> how big the THPs are - and that's only available for CONFIG_THP.
>
> Add the necessary ifdefs. /proc/meminfo, smaps etc. also don't show
> the THP counters when the feature is compiled out. The event counts
> (THP_FAULT_ALLOC, THP_COLLAPSE_ALLOC) were already conditional also.
>
> Style touchup: HPAGE_PMD_NR * PAGE_SIZE is silly. Use HPAGE_PMD_SIZE.
>
> Reported-by: Randy Dunlap 
> Signed-off-by: Johannes Weiner 
> ---
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 738d071ba1ef..47c685088a2c 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1401,9 +1401,11 @@ static char *memory_stat_format(struct mem_cgroup 
> *memcg)
>(u64)memcg_page_state(memcg, NR_WRITEBACK) *
>PAGE_SIZE);
>
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> seq_buf_printf(, "anon_thp %llu\n",
>(u64)memcg_page_state(memcg, NR_ANON_THPS) *
> -  HPAGE_PMD_NR * PAGE_SIZE);
> +  HPAGE_PMD_SIZE);
> +#endif
>
> for (i = 0; i < NR_LRU_LISTS; i++)
> seq_buf_printf(, "%s %llu\n", 

Re: mmotm 2020-05-11-15-43 uploaded (mm/memcontrol.c, huge pages)

2020-05-12 Thread Naresh Kamboju
> The THP page size macros are CONFIG_TRANSPARENT_HUGEPAGE only.
>
> We already ifdef most THP-related code in memcg, but not these
> particular stats. Memcg used to track the pages as they came in, and
> PageTransHuge() + hpage_nr_pages() work when THP is not compiled in.
>
> Switching to native vmstat counters, memcg doesn't see the pages, it
> only gets a count of THPs. To translate that to bytes, it has to know
> how big the THPs are - and that's only available for CONFIG_THP.
>
> Add the necessary ifdefs. /proc/meminfo, smaps etc. also don't show
> the THP counters when the feature is compiled out. The event counts
> (THP_FAULT_ALLOC, THP_COLLAPSE_ALLOC) were already conditional also.
>
> Style touchup: HPAGE_PMD_NR * PAGE_SIZE is silly. Use HPAGE_PMD_SIZE.

Build tested and build pass on x86_64.

>
> Reported-by: Randy Dunlap 
> Signed-off-by: Johannes Weiner 

Tested-by: Naresh Kamboju 

> ---
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 738d071ba1ef..47c685088a2c 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1401,9 +1401,11 @@ static char *memory_stat_format(struct mem_cgroup 
> *memcg)
>(u64)memcg_page_state(memcg, NR_WRITEBACK) *
>PAGE_SIZE);
>
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> seq_buf_printf(, "anon_thp %llu\n",
>(u64)memcg_page_state(memcg, NR_ANON_THPS) *
> -  HPAGE_PMD_NR * PAGE_SIZE);
> +  HPAGE_PMD_SIZE);
> +#endif
>
> for (i = 0; i < NR_LRU_LISTS; i++)
> seq_buf_printf(, "%s %llu\n", lru_list_name(i),
> @@ -3752,7 +3754,9 @@ static int memcg_numa_stat_show(struct seq_file *m, 
> void *v)
>  static const unsigned int memcg1_stats[] = {
> NR_FILE_PAGES,
> NR_ANON_MAPPED,
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> NR_ANON_THPS,
> +#endif
> NR_SHMEM,
> NR_FILE_MAPPED,
> NR_FILE_DIRTY,
> @@ -3763,7 +3767,9 @@ static const unsigned int memcg1_stats[] = {
>  static const char *const memcg1_stat_names[] = {
> "cache",
> "rss",
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> "rss_huge",
> +#endif
> "shmem",
> "mapped_file",
> "dirty",
> @@ -3794,8 +3800,10 @@ static int memcg_stat_show(struct seq_file *m, void *v)
> if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
> continue;
> nr = memcg_page_state_local(memcg, memcg1_stats[i]);
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> if (memcg1_stats[i] == NR_ANON_THPS)
> nr *= HPAGE_PMD_NR;
> +#endif
> seq_printf(m, "%s %lu\n", memcg1_stat_names[i], nr * 
> PAGE_SIZE);
> }
>


-- 
Linaro LKFT
https://lkft.linaro.org


Re: mmotm 2020-05-11-15-43 uploaded (mm/memcontrol.c, huge pages)

2020-05-12 Thread Randy Dunlap
On 5/12/20 5:17 AM, Johannes Weiner wrote:

> 
> ---
> 
> Randy reports:
> 
>> on x86_64:
>>
>> In file included from ../arch/x86/include/asm/atomic.h:5:0,
>>  from ../include/linux/atomic.h:7,
>>  from ../include/linux/page_counter.h:5,
>>  from ../mm/memcontrol.c:25:
>> ../mm/memcontrol.c: In function ‘memcg_stat_show’:
>> ../include/linux/compiler.h:394:38: error: call to 
>> ‘__compiletime_assert_383’ declared with attribute error: BUILD_BUG failed
>>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>   ^
>> ../include/linux/compiler.h:375:4: note: in definition of macro 
>> ‘__compiletime_assert’
>> prefix ## suffix();\
>> ^~
>> ../include/linux/compiler.h:394:2: note: in expansion of macro 
>> ‘_compiletime_assert’
>>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>>   ^~~
>> ../include/linux/build_bug.h:39:37: note: in expansion of macro 
>> ‘compiletime_assert’
>>  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>>  ^~
>> ../include/linux/build_bug.h:59:21: note: in expansion of macro 
>> ‘BUILD_BUG_ON_MSG’
>>  #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>>  ^~~~
>> ../include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>>  #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
> 
> The THP page size macros are CONFIG_TRANSPARENT_HUGEPAGE only.
> 
> We already ifdef most THP-related code in memcg, but not these
> particular stats. Memcg used to track the pages as they came in, and
> PageTransHuge() + hpage_nr_pages() work when THP is not compiled in.
> 
> Switching to native vmstat counters, memcg doesn't see the pages, it
> only gets a count of THPs. To translate that to bytes, it has to know
> how big the THPs are - and that's only available for CONFIG_THP.
> 
> Add the necessary ifdefs. /proc/meminfo, smaps etc. also don't show
> the THP counters when the feature is compiled out. The event counts
> (THP_FAULT_ALLOC, THP_COLLAPSE_ALLOC) were already conditional also.
> 
> Style touchup: HPAGE_PMD_NR * PAGE_SIZE is silly. Use HPAGE_PMD_SIZE.
> 
> Reported-by: Randy Dunlap 
> Signed-off-by: Johannes Weiner 

Acked-by: Randy Dunlap  # build-tested

Thanks.

> ---
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 738d071ba1ef..47c685088a2c 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1401,9 +1401,11 @@ static char *memory_stat_format(struct mem_cgroup 
> *memcg)
>  (u64)memcg_page_state(memcg, NR_WRITEBACK) *
>  PAGE_SIZE);
>  
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>   seq_buf_printf(, "anon_thp %llu\n",
>  (u64)memcg_page_state(memcg, NR_ANON_THPS) *
> -HPAGE_PMD_NR * PAGE_SIZE);
> +HPAGE_PMD_SIZE);
> +#endif
>  
>   for (i = 0; i < NR_LRU_LISTS; i++)
>   seq_buf_printf(, "%s %llu\n", lru_list_name(i),
> @@ -3752,7 +3754,9 @@ static int memcg_numa_stat_show(struct seq_file *m, 
> void *v)
>  static const unsigned int memcg1_stats[] = {
>   NR_FILE_PAGES,
>   NR_ANON_MAPPED,
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>   NR_ANON_THPS,
> +#endif
>   NR_SHMEM,
>   NR_FILE_MAPPED,
>   NR_FILE_DIRTY,
> @@ -3763,7 +3767,9 @@ static const unsigned int memcg1_stats[] = {
>  static const char *const memcg1_stat_names[] = {
>   "cache",
>   "rss",
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>   "rss_huge",
> +#endif
>   "shmem",
>   "mapped_file",
>   "dirty",
> @@ -3794,8 +3800,10 @@ static int memcg_stat_show(struct seq_file *m, void *v)
>   if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
>   continue;
>   nr = memcg_page_state_local(memcg, memcg1_stats[i]);
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
>   if (memcg1_stats[i] == NR_ANON_THPS)
>   nr *= HPAGE_PMD_NR;
> +#endif
>   seq_printf(m, "%s %lu\n", memcg1_stat_names[i], nr * PAGE_SIZE);
>   }
>  
> 


-- 
~Randy


Re: mmotm 2020-05-11-15-43 uploaded (mm/memcontrol.c, huge pages)

2020-05-12 Thread Geert Uytterhoeven
On Tue, May 12, 2020 at 6:44 AM Randy Dunlap  wrote:
> On 5/11/20 3:44 PM, Andrew Morton wrote:
> > The mm-of-the-moment snapshot 2020-05-11-15-43 has been uploaded to
> >
> >http://www.ozlabs.org/~akpm/mmotm/
> >
> > mmotm-readme.txt says
> >
> > README for mm-of-the-moment:
> >
> > http://www.ozlabs.org/~akpm/mmotm/
> >
> > This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
> > more than once a week.
> >
> > You will need quilt to apply these patches to the latest Linus release (5.x
> > or 5.x-rcY).  The series file is in broken-out.tar.gz and is duplicated in
> > http://ozlabs.org/~akpm/mmotm/series
> >
> > The file broken-out.tar.gz contains two datestamp files: .DATE and
> > .DATE--mm-dd-hh-mm-ss.  Both contain the string -mm-dd-hh-mm-ss,
> > followed by the base kernel version against which this patch series is to
> > be applied.
> >
> > This tree is partially included in linux-next.  To see which patches are
> > included in linux-next, consult the `series' file.  Only the patches
> > within the #NEXT_PATCHES_START/#NEXT_PATCHES_END markers are included in
> > linux-next.
> >
> >
> > A full copy of the full kernel tree with the linux-next and mmotm patches
> > already applied is available through git within an hour of the mmotm
> > release.  Individual mmotm releases are tagged.  The master branch always
> > points to the latest release, so it's constantly rebasing.
> >
> >   https://github.com/hnaz/linux-mm
> >
> > The directory http://www.ozlabs.org/~akpm/mmots/ (mm-of-the-second)
> > contains daily snapshots of the -mm tree.  It is updated more frequently
> > than mmotm, and is untested.
> >
> > A git copy of this tree is also available at
> >
> >   https://github.com/hnaz/linux-mm
>
> on x86_64:
>
> In file included from ../arch/x86/include/asm/atomic.h:5:0,
>  from ../include/linux/atomic.h:7,
>  from ../include/linux/page_counter.h:5,
>  from ../mm/memcontrol.c:25:
> ../mm/memcontrol.c: In function ‘memcg_stat_show’:
> ../include/linux/compiler.h:394:38: error: call to ‘__compiletime_assert_383’ 
> declared with attribute error: BUILD_BUG failed
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^
> ../include/linux/compiler.h:375:4: note: in definition of macro 
> ‘__compiletime_assert’
> prefix ## suffix();\
> ^~
> ../include/linux/compiler.h:394:2: note: in expansion of macro 
> ‘_compiletime_assert’
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^~~
> ../include/linux/build_bug.h:39:37: note: in expansion of macro 
> ‘compiletime_assert’
>  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>  ^~
> ../include/linux/build_bug.h:59:21: note: in expansion of macro 
> ‘BUILD_BUG_ON_MSG’
>  #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>  ^~~~
> ../include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>  #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
> ^
> ../include/linux/huge_mm.h:115:26: note: in expansion of macro 
> ‘HPAGE_PMD_SHIFT’
>  #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
>   ^~~
> ../include/linux/huge_mm.h:116:26: note: in expansion of macro 
> ‘HPAGE_PMD_ORDER’
>  #define HPAGE_PMD_NR (1<   ^~~
> ../mm/memcontrol.c:3746:10: note: in expansion of macro ‘HPAGE_PMD_NR’
> nr *= HPAGE_PMD_NR;
>   ^~~~
>   CC  arch/x86/kernel/jump_label.o
> ../mm/memcontrol.c: In function ‘memory_stat_format’:
> ../include/linux/compiler.h:394:38: error: call to ‘__compiletime_assert_356’ 
> declared with attribute error: BUILD_BUG failed
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^
> ../include/linux/compiler.h:375:4: note: in definition of macro 
> ‘__compiletime_assert’
> prefix ## suffix();\
> ^~
> ../include/linux/compiler.h:394:2: note: in expansion of macro 
> ‘_compiletime_assert’
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^~~
> ../include/linux/build_bug.h:39:37: note: in expansion of macro 
> ‘compiletime_assert’
>  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>  ^~
> ../include/linux/build_bug.h:59:21: note: in expansion of macro 
> ‘BUILD_BUG_ON_MSG’
>  #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>  ^~~~
> ../include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>  #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
> ^
> ../include/linux/huge_mm.h:115:26: note: in expansion of macro 
> 

Re: mmotm 2020-05-11-15-43 uploaded (mm/memcontrol.c, huge pages)

2020-05-12 Thread Johannes Weiner
On Mon, May 11, 2020 at 09:41:24PM -0700, Randy Dunlap wrote:
> On 5/11/20 3:44 PM, Andrew Morton wrote:
> > The mm-of-the-moment snapshot 2020-05-11-15-43 has been uploaded to
> > 
> >http://www.ozlabs.org/~akpm/mmotm/
> > 
> > mmotm-readme.txt says
> > 
> > README for mm-of-the-moment:
> > 
> > http://www.ozlabs.org/~akpm/mmotm/
> > 
> > This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
> > more than once a week.
> > 
> > You will need quilt to apply these patches to the latest Linus release (5.x
> > or 5.x-rcY).  The series file is in broken-out.tar.gz and is duplicated in
> > http://ozlabs.org/~akpm/mmotm/series
> > 
> > The file broken-out.tar.gz contains two datestamp files: .DATE and
> > .DATE--mm-dd-hh-mm-ss.  Both contain the string -mm-dd-hh-mm-ss,
> > followed by the base kernel version against which this patch series is to
> > be applied.
> > 
> > This tree is partially included in linux-next.  To see which patches are
> > included in linux-next, consult the `series' file.  Only the patches
> > within the #NEXT_PATCHES_START/#NEXT_PATCHES_END markers are included in
> > linux-next.
> > 
> > 
> > A full copy of the full kernel tree with the linux-next and mmotm patches
> > already applied is available through git within an hour of the mmotm
> > release.  Individual mmotm releases are tagged.  The master branch always
> > points to the latest release, so it's constantly rebasing.
> > 
> > https://github.com/hnaz/linux-mm
> > 
> > The directory http://www.ozlabs.org/~akpm/mmots/ (mm-of-the-second)
> > contains daily snapshots of the -mm tree.  It is updated more frequently
> > than mmotm, and is untested.
> > 
> > A git copy of this tree is also available at
> > 
> > https://github.com/hnaz/linux-mm

Thanks for the report, Randy.

---

Randy reports:

> on x86_64:
> 
> In file included from ../arch/x86/include/asm/atomic.h:5:0,
>  from ../include/linux/atomic.h:7,
>  from ../include/linux/page_counter.h:5,
>  from ../mm/memcontrol.c:25:
> ../mm/memcontrol.c: In function ‘memcg_stat_show’:
> ../include/linux/compiler.h:394:38: error: call to ‘__compiletime_assert_383’ 
> declared with attribute error: BUILD_BUG failed
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^
> ../include/linux/compiler.h:375:4: note: in definition of macro 
> ‘__compiletime_assert’
> prefix ## suffix();\
> ^~
> ../include/linux/compiler.h:394:2: note: in expansion of macro 
> ‘_compiletime_assert’
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^~~
> ../include/linux/build_bug.h:39:37: note: in expansion of macro 
> ‘compiletime_assert’
>  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>  ^~
> ../include/linux/build_bug.h:59:21: note: in expansion of macro 
> ‘BUILD_BUG_ON_MSG’
>  #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
>  ^~~~
> ../include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
>  #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })

The THP page size macros are CONFIG_TRANSPARENT_HUGEPAGE only.

We already ifdef most THP-related code in memcg, but not these
particular stats. Memcg used to track the pages as they came in, and
PageTransHuge() + hpage_nr_pages() work when THP is not compiled in.

Switching to native vmstat counters, memcg doesn't see the pages, it
only gets a count of THPs. To translate that to bytes, it has to know
how big the THPs are - and that's only available for CONFIG_THP.

Add the necessary ifdefs. /proc/meminfo, smaps etc. also don't show
the THP counters when the feature is compiled out. The event counts
(THP_FAULT_ALLOC, THP_COLLAPSE_ALLOC) were already conditional also.

Style touchup: HPAGE_PMD_NR * PAGE_SIZE is silly. Use HPAGE_PMD_SIZE.

Reported-by: Randy Dunlap 
Signed-off-by: Johannes Weiner 
---

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 738d071ba1ef..47c685088a2c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1401,9 +1401,11 @@ static char *memory_stat_format(struct mem_cgroup *memcg)
   (u64)memcg_page_state(memcg, NR_WRITEBACK) *
   PAGE_SIZE);
 
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
seq_buf_printf(, "anon_thp %llu\n",
   (u64)memcg_page_state(memcg, NR_ANON_THPS) *
-  HPAGE_PMD_NR * PAGE_SIZE);
+  HPAGE_PMD_SIZE);
+#endif
 
for (i = 0; i < NR_LRU_LISTS; i++)
seq_buf_printf(, "%s %llu\n", lru_list_name(i),
@@ -3752,7 +3754,9 @@ static int memcg_numa_stat_show(struct seq_file *m, void 
*v)
 static const unsigned int memcg1_stats[] = {
NR_FILE_PAGES,
NR_ANON_MAPPED,
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
NR_ANON_THPS,
+#endif
NR_SHMEM,

Re: mmotm 2020-05-11-15-43 uploaded (mm/memcontrol.c, huge pages)

2020-05-11 Thread Randy Dunlap
On 5/11/20 3:44 PM, Andrew Morton wrote:
> The mm-of-the-moment snapshot 2020-05-11-15-43 has been uploaded to
> 
>http://www.ozlabs.org/~akpm/mmotm/
> 
> mmotm-readme.txt says
> 
> README for mm-of-the-moment:
> 
> http://www.ozlabs.org/~akpm/mmotm/
> 
> This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
> more than once a week.
> 
> You will need quilt to apply these patches to the latest Linus release (5.x
> or 5.x-rcY).  The series file is in broken-out.tar.gz and is duplicated in
> http://ozlabs.org/~akpm/mmotm/series
> 
> The file broken-out.tar.gz contains two datestamp files: .DATE and
> .DATE--mm-dd-hh-mm-ss.  Both contain the string -mm-dd-hh-mm-ss,
> followed by the base kernel version against which this patch series is to
> be applied.
> 
> This tree is partially included in linux-next.  To see which patches are
> included in linux-next, consult the `series' file.  Only the patches
> within the #NEXT_PATCHES_START/#NEXT_PATCHES_END markers are included in
> linux-next.
> 
> 
> A full copy of the full kernel tree with the linux-next and mmotm patches
> already applied is available through git within an hour of the mmotm
> release.  Individual mmotm releases are tagged.  The master branch always
> points to the latest release, so it's constantly rebasing.
> 
>   https://github.com/hnaz/linux-mm
> 
> The directory http://www.ozlabs.org/~akpm/mmots/ (mm-of-the-second)
> contains daily snapshots of the -mm tree.  It is updated more frequently
> than mmotm, and is untested.
> 
> A git copy of this tree is also available at
> 
>   https://github.com/hnaz/linux-mm

on x86_64:

In file included from ../arch/x86/include/asm/atomic.h:5:0,
 from ../include/linux/atomic.h:7,
 from ../include/linux/page_counter.h:5,
 from ../mm/memcontrol.c:25:
../mm/memcontrol.c: In function ‘memcg_stat_show’:
../include/linux/compiler.h:394:38: error: call to ‘__compiletime_assert_383’ 
declared with attribute error: BUILD_BUG failed
  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
  ^
../include/linux/compiler.h:375:4: note: in definition of macro 
‘__compiletime_assert’
prefix ## suffix();\
^~
../include/linux/compiler.h:394:2: note: in expansion of macro 
‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
  ^~~
../include/linux/build_bug.h:39:37: note: in expansion of macro 
‘compiletime_assert’
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
 ^~
../include/linux/build_bug.h:59:21: note: in expansion of macro 
‘BUILD_BUG_ON_MSG’
 #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
 ^~~~
../include/linux/huge_mm.h:319:28: note: in expansion of macro ‘BUILD_BUG’
 #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^
../include/linux/huge_mm.h:115:26: note: in expansion of macro ‘HPAGE_PMD_SHIFT’
 #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
  ^~~
../include/linux/huge_mm.h:116:26: note: in expansion of macro ‘HPAGE_PMD_ORDER’
 #define HPAGE_PMD_NR (1<
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 5.7.0-rc5-mm1 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (SUSE Linux) 7.5.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=70500
CONFIG_LD_VERSION=23200
CONFIG_CLANG_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_HAS_ASM_GOTO=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
CONFIG_UAPI_HEADER_TEST=y
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
CONFIG_KERNEL_LZO=y
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_WATCH_QUEUE is not set
CONFIG_CROSS_MEMORY_ATTACH=y
# CONFIG_USELIB is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_INJECTION=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y
CONFIG_GENERIC_IRQ_RESERVATION_MODE=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_GENERIC_IRQ_DEBUGFS=y
# end of IRQ subsystem

CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_INIT=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y