Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Hui Zhu <hui.zhu@linux.dev>
Cc: 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>,
	Chris Down <chris@chrisdown.name>,
	zhangjiao2@cmss.chinamobile.com,
	Alireza Asgari <alireza@asgari.net>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Hui Zhu <zhuhui@kylinos.cn>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mm: memcg: fix zero throttle delay on 32-bit kernels
Date: Fri, 4 Dec 2026 09:02:07 -0500	[thread overview]
Message-ID: <axLH3-MXFm8MMFLC@cmpxchg.org> (raw)
In-Reply-To: <1ef1fa130f9bd4a94bf92335486729f05034c30d.1796367145.git.zhuhui@kylinos.cn>

On Fri, Dec 04, 2026 at 03:18:19PM +0800, Hui Zhu wrote:
> From: Hui Zhu <zhuhui@kylinos.cn>
> 
> calculate_high_delay() stores max_overage * max_overage * HZ, computed as
> u64, into an unsigned long before shifting it right by 34 bits in total.
> On 32-bit kernels the store truncates the value to its low 32 bits, so the
> shift always yields zero: memory.high and memory.swap.high throttling is
> completely inert there. And since the caller reads "penalty_jiffies <=
> HZ / 100" as "nothing to do", the MAX_RECLAIM_RETRIES reclaim loop is
> skipped as well.
> 
> Keep the intermediate in u64 so the shifts see the full width. Also make
> the function return u64, and the caller's penalty_jiffies u64, so the
> value is narrowed only after the caller has clamped it to
> MEMCG_MAX_HIGH_DELAY_JIFFIES. Nothing changes on 64-bit kernels, where
> unsigned long is already 64 bits wide.
> 
> Fixes: e26733e0d0ec ("mm, memcg: throttle allocators based on ancestral memory.high")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hui Zhu <zhuhui@kylinos.cn>

Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>

  reply	other threads:[~2026-12-04 14:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1796367145.git.zhuhui@kylinos.cn>
2026-12-04  7:18 ` [PATCH v2 1/2] mm: memcg: fix zero throttle delay on 32-bit kernels Hui Zhu
2026-12-04 14:02   ` Johannes Weiner [this message]
2026-12-04 16:30   ` Shakeel Butt
2026-12-04  7:18 ` [PATCH v2 2/2] mm: memcg: fix memory.high throttle lost to u64 overflow Hui Zhu
2026-12-04 14:03   ` Johannes Weiner
2026-12-04 16:36   ` Shakeel Butt

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=axLH3-MXFm8MMFLC@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=alireza@asgari.net \
    --cc=cgroups@vger.kernel.org \
    --cc=chris@chrisdown.name \
    --cc=hui.zhu@linux.dev \
    --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=stable@vger.kernel.org \
    --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