[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e44be2c-7039-710b-202f-c452bfc3f1ad@huawei.com>
Date: Fri, 28 Jun 2024 16:09:02 +0800
From: xiujianfeng <xiujianfeng@...wei.com>
To: Michal Hocko <mhocko@...e.com>
CC: <hannes@...xchg.org>, <roman.gushchin@...ux.dev>,
<shakeel.butt@...ux.dev>, <muchun.song@...ux.dev>,
<akpm@...ux-foundation.org>, <cgroups@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] mm: memcg: adjust the warning when seq_buf
overflows
On 2024/6/28 15:45, Michal Hocko wrote:
> On Fri 28-06-24 07:23:33, Xiu Jianfeng wrote:
>> Currently it uses WARN_ON_ONCE() if seq_buf overflows when user reads
>> memory.stat, the only advantage of WARN_ON_ONCE is that the splat is
>> so verbose that it gets noticed. And also it panics the system if
>> panic_on_warn is enabled. It seems like the warning is just an over
>> reaction and a simple pr_warn should just achieve the similar effect.
>>
>> Suggested-by: Michal Hocko <mhocko@...e.com>
>> Signed-off-by: Xiu Jianfeng <xiujianfeng@...wei.com>
>
> Acked-by: Michal Hocko <mhocko@...e.com>
>
> I would just squash this with other patch removing it from
> memcg_stat_format. But this is up to you.
Sorry, I might have misunderstood, if you can squash them, it looks good
to me, thanks.
>
> Thanks!
>
>> ---
>> mm/memcontrol.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index c251bbe35f4b..8e5590ac43d7 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -1484,7 +1484,8 @@ static void memory_stat_format(struct mem_cgroup *memcg, struct seq_buf *s)
>> memcg_stat_format(memcg, s);
>> else
>> memcg1_stat_format(memcg, s);
>> - WARN_ON_ONCE(seq_buf_has_overflowed(s));
>> + if (seq_buf_has_overflowed(s))
>> + pr_warn("%s: Warning, stat buffer overflow, please report\n", __func__);
>> }
>>
>> /**
>> --
>> 2.34.1
>>
>
Powered by blists - more mailing lists