[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251218073613.5145-1-kdipendra88@gmail.com>
Date: Thu, 18 Dec 2025 07:36:13 +0000
From: Dipendra Khadka <kdipendra88@...il.com>
To: shakeel.butt@...ux.dev
Cc: akpm@...ux-foundation.org,
cgroups@...r.kernel.org,
hannes@...xchg.org,
kdipendra88@...il.com,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
mhocko@...nel.org,
muchun.song@...ux.dev,
roman.gushchin@...ux.dev
Subject: Re: [PATCH] mm/memcg: reorder retry checks for clarity in try_charge_memcg
> Why hopeless?
Because in this specific path the allocating task is already the OOM
victim (TIF_MEMDIE set). Any reclaim attempt performed by that task is
unlikely to make progress for its own allocation, since the kernel has
already decided that freeing this task’s memory is the resolution
mechanism. Reclaim may free some pages globally, but the victim itself
will still be exiting shortly, making retries for its own allocation
non-actionable.
> Why optimize for this case?
I agree this is a narrow case, but it is also a delicate one. The
motivation is not performance in the general sense, but avoiding extra
complexity and repeated reclaim attempts in a code path that is already
operating under exceptional conditions. The early exit reduces retry
churn for a task that is guaranteed to terminate, without affecting
non-victim allocators.
> Since oom_reaper will reap the memory of the killed process, do we
> really care about if killed process is delayed a bit due to reclaim?
Not strongly from a functional standpoint. The concern is more about
control flow clarity and avoiding unnecessary reclaim loops while the
task is already in a terminal state. I agree that this is not a
correctness issue by itself, but rather an attempt to avoid redundant
work in an already resolved situation.
> How is this relevant here?
This was meant to explain why exiting early does not introduce new
failure modes for the victim task. Even if the victim still performs
allocations briefly, the slowpath mechanisms already allow limited
forward progress. I agree this does not directly justify the reordering
by itself.
> Same, how is this relevant to victim safety?
Same answer here — these mechanisms ensure that the victim does not
regress functionally if retries are skipped, but they are not intended
as the primary justification for the change.
The primary intent of the patch is to avoid retrying reclaim for the
current task once it has been marked as dying, not to change OOM
resolution behavior. If this rationale is insufficient, I’m happy to
drop the patch or rework it with clearer justification or measurable
evidence.
Powered by blists - more mailing lists