From: "Hui Zhu" <hui.zhu@linux.dev>
To: "zhangjiao2" <zhangjiao2@cmss.chinamobile.com>
Cc: "Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Hocko" <mhocko@kernel.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Muchun Song" <muchun.song@linux.dev>,
"Andrew Morton" <akpm@linux-foundation.org>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, "Hui Zhu" <zhuhui@kylinos.cn>,
"Song Hu" <husong@kylinos.cn>,
"Joshua Hahn" <joshua.hahnjy@gmail.com>,
"Chris Down" <chris@chrisdown.name>
Subject: Re: [PATCH 0/2] mm: memcg: fix memory.high allocator throttling
Date: Wed, 25 Nov 2026 07:58:18 +0000 [thread overview]
Message-ID: <8f0abedb57eb51b09fbfca232fcc0f6eb0dedd03@linux.dev> (raw)
In-Reply-To: <6e73ae4b-5400-4f6d-bf5b-2892827ea144@linux.dev>
"Hui Zhu" <hui.zhu@linux.dev mailto:hui.zhu@linux.dev?to=%22Hui%20Zhu%22%20%3Chui.zhu%40linux.dev%3E >:
>
> 2026/11/18 06:17, Chris Down:
>
> >
> > Hi Hui,
> >
> > Thanks for fixing these, I've verified that these fix the issues
> > reported.
> >
> > That said, Zhang Jiao sent a fix for the same two problems a few weeks
> > ago, and Johannes thought the overage cap there was a bit of a magic
> > value, which we have plenty of in mm already, and I agree we shouldn't
> > add more [1].
> >
> > Could you please coordinate so we don't have two patchsets doing the
> > same thing?
> >
> > Chris
> >
> > [1] https://lore.kernel.org/all/auNrakxaET8qkuAn@cmpxchg.org/
> >
> Hi Chris, Joshua, Zhang Jiao,
>
> Chris: thanks for the pointer, and apologies for the duplicate. I missed
> Zhang Jiao's patch [1], and Song Hu's earlier report of the overflow, which
> already proposed check_mul_overflow() [2]. I've added Zhang Jiao to the
> thread so we can settle the coordination here rather than off-list.
>
> You and Johannes are right about the cap. I've dropped
> MEMCG_MAX_DELAY_OVERAGE and reworked 2/2 into the shape Johannes suggested,
> with calculate_high_delay() and the caller's penalty_jiffies both in u64 so
> the value is narrowed only after the caller's clamp. That also removes the
> in-function min() from 1/2, which was undoing ff144e69f733 ("mm/memcg: move
> penalty delay clamping out of calculate_high_delay()"). The series shrinks
> from 19 insertions to 9.
>
> Joshua: the Fixes tag is the right one, though I can see why the diff
> suggested otherwise. The division comes from 0e4b01df8659; my patch only
> touched that line to add the clamp. The bug is the reordering in
> e26733e0d0ec, which replaced
>
> penalty_jiffies = ((u64)overage * overage * HZ)
> >> (MEMCG_DELAY_PRECISION_SHIFT + MEMCG_DELAY_SCALING_SHIFT);
>
> with
>
> penalty_jiffies = max_overage * max_overage * HZ;
> penalty_jiffies >>= MEMCG_DELAY_PRECISION_SHIFT;
> penalty_jiffies >>= MEMCG_DELAY_SCALING_SHIFT;
>
> Before that, the shift ran on the u64 temporary and the narrowing into
> unsigned long happened afterwards. After it, the value is narrowed
> first, so shifting it right by 34 always yields zero. The division plays
> no part, and in v2 the diff no longer goes near it. Your other point is
> settled by the same rework: with the clamp gone, the comment goes too.
>
> How I'd like to proceed:
>
> - Zhang Jiao: would it be OK if I send the combined series? The overflow
> fix stays under your name and keeps your changelog, in the shape
> Johannes suggested, and I'd carry the 32-bit truncation alongside it in
> the same series. If you would rather send it yourself, or split it
> differently, say so and I'll follow.
>
> - Song Hu and I have been in touch off-list, and they are working in this
> area as well, so the patches under my name will carry them as
> Co-developed-by.
>
> - v2 will include what was missing before: a Fixes tag for each of the two
> regressions (e26733e0d0ec, v5.6, for the 32-bit truncation;
> 0e4b01df8659, v5.4, for the overflow), Cc: stable, a changelog that says
> plainly that throttling was completely inert on 32-bit, and the wrap
> threshold corrected to about 130x at HZ=1000 -- the 4096x figure misses
> the HZ factor.
>
> Two separate patches rather than one, because they are different
> regressions with different lifetimes, which matters for the stable
> backports.
>
> One number that may be worth putting in the changelog: the smallest
> exact-zero case is memory.high at one page with usage at 2049 pages, where
> max_overage is exactly 2^31 and the product wraps to zero.
>
> Thanks,
> Hui
>
> [1] https://lore.kernel.org/all/20261029073857.974-1-zhangjiao2@cmss.chinamobile.com/
> [2] https://lore.kernel.org/all/20260818012115.65838-1-husong@kylinos.cn/
>
Hi Zhang Jiao,
Gentle ping: OK if I send the combined series with the overflow fix under
your name? If you're busy, I can carry it forward and credit you.
Thanks,
Hui
prev parent reply other threads:[~2026-11-25 7:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 8:04 [PATCH 0/2] mm: memcg: fix memory.high allocator throttling Hui Zhu
2026-11-17 8:04 ` [PATCH 1/2] mm: memcg: fix zero throttle delay on 32-bit kernels Hui Zhu
2026-11-17 23:57 ` Joshua Hahn
2026-11-17 8:04 ` [PATCH 2/2] mm: memcg: fix memory.high throttle lost to u64 overflow Hui Zhu
2026-11-17 22:17 ` [PATCH 0/2] mm: memcg: fix memory.high allocator throttling Chris Down
2026-11-18 5:38 ` Hui Zhu
2026-11-25 7:58 ` Hui Zhu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f0abedb57eb51b09fbfca232fcc0f6eb0dedd03@linux.dev \
--to=hui.zhu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=chris@chrisdown.name \
--cc=hannes@cmpxchg.org \
--cc=husong@kylinos.cn \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=zhangjiao2@cmss.chinamobile.com \
--cc=zhuhui@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox