* Re: + mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix.patch added to -mm tree
[not found] <20201026210801.n9JtTzchy%akpm@linux-foundation.org>
@ 2020-10-27 7:21 ` Michal Hocko
2020-10-28 23:24 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Michal Hocko @ 2020-10-27 7:21 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, hannes, mm-commits, zhongjiang-ali
On Mon 26-10-20 14:08:01, Andrew Morton wrote:
[...]
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix
>
> fix printk warning
>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: zhongjiang-ali <zhongjiang-ali@linux.alibaba.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/memcontrol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/mm/memcontrol.c~mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix
> +++ a/mm/memcontrol.c
> @@ -4107,7 +4107,7 @@ static int memcg_stat_show(struct seq_fi
> if (memcg1_stats[i] == NR_ANON_THPS)
> nr *= HPAGE_PMD_NR;
> #endif
> - seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
> + seq_printf(m, "total_%s %lu\n", memcg1_stat_names[i],
> nr * PAGE_SIZE);
Shouldn't we cast to u64 instead? 32b systems with a lot of memory are
quite rare but going over 4G here is not something unimaginable. The
similar is true for other counters.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: + mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix.patch added to -mm tree
2020-10-27 7:21 ` + mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix.patch added to -mm tree Michal Hocko
@ 2020-10-28 23:24 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2020-10-28 23:24 UTC (permalink / raw)
To: Michal Hocko; +Cc: linux-kernel, hannes, mm-commits, zhongjiang-ali
On Tue, 27 Oct 2020 08:21:57 +0100 Michal Hocko <mhocko@suse.com> wrote:
> > --- a/mm/memcontrol.c~mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix
> > +++ a/mm/memcontrol.c
> > @@ -4107,7 +4107,7 @@ static int memcg_stat_show(struct seq_fi
> > if (memcg1_stats[i] == NR_ANON_THPS)
> > nr *= HPAGE_PMD_NR;
> > #endif
> > - seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
> > + seq_printf(m, "total_%s %lu\n", memcg1_stat_names[i],
> > nr * PAGE_SIZE);
>
> Shouldn't we cast to u64 instead? 32b systems with a lot of memory are
> quite rare but going over 4G here is not something unimaginable. The
> similar is true for other counters.
Sure..
--- a/mm/memcontrol.c~mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix-fix
+++ a/mm/memcontrol.c
@@ -4119,8 +4119,8 @@ static int memcg_stat_show(struct seq_fi
if (memcg1_stats[i] == NR_ANON_THPS)
nr *= HPAGE_PMD_NR;
#endif
- seq_printf(m, "total_%s %lu\n", memcg1_stat_names[i],
- nr * PAGE_SIZE);
+ seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
+ (u64)nr * PAGE_SIZE);
}
for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
_
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-28 23:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20201026210801.n9JtTzchy%akpm@linux-foundation.org>
2020-10-27 7:21 ` + mm-memcontrol-correct-the-nr_anon_thps-counter-of-hierarchical-memcg-fix.patch added to -mm tree Michal Hocko
2020-10-28 23:24 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®