* [to-be-updated] memcg-dont-generate-low-min-events-if-either-low-min-or-elow-emin-is-0.patch removed from -mm tree
@ 2025-04-07 0:59 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-04-07 0:59 UTC (permalink / raw)
To: mm-commits, shakeel.butt, roman.gushchin, muchun.song, mhocko,
hannes, longman, akpm
The quilt patch titled
Subject: memcg: don't generate low/min events if either low/min or elow/emin is 0
has been removed from the -mm tree. Its filename was
memcg-dont-generate-low-min-events-if-either-low-min-or-elow-emin-is-0.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Waiman Long <longman@redhat.com>
Subject: memcg: don't generate low/min events if either low/min or elow/emin is 0
Date: Wed, 2 Apr 2025 23:12:12 -0400
The test_memcontrol selftest consistently fails its test_memcg_low
sub-test because of the fact that two of its test child cgroups which have
a memmory.low of 0 or an effective memory.low of 0 still have low events
generated for them since mem_cgroup_below_low() use the ">=" operator when
comparing to elow.
The simple fix of changing the operator to ">", however, changes the way
memory reclaim works quite drastically leading to other failures. So we
can't do that without some relatively riskier changes in memory reclaim.
Another simpler alternative is to avoid reporting below_low failure if
either memory.low or its effective equivalent is 0 which is done by this
patch.
With this patch applied, the test_memcg_low sub-test finishes successfully
without failure in most cases. Though both test_memcg_low and
test_memcg_min sub-tests may fail occasionally if the memory.current
values fall outside of the expected ranges.
To be consistent, similar change is appled to mem_cgroup_below_min()
as well.
Link: https://lkml.kernel.org/r/20250403031212.317837-1-longman@redhat.com
Signed-off-by: Waiman Long <longman@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/memcontrol.h | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
--- a/include/linux/memcontrol.h~memcg-dont-generate-low-min-events-if-either-low-min-or-elow-emin-is-0
+++ a/include/linux/memcontrol.h
@@ -601,21 +601,31 @@ static inline bool mem_cgroup_unprotecte
static inline bool mem_cgroup_below_low(struct mem_cgroup *target,
struct mem_cgroup *memcg)
{
+ unsigned long elow;
+
if (mem_cgroup_unprotected(target, memcg))
return false;
- return READ_ONCE(memcg->memory.elow) >=
- page_counter_read(&memcg->memory);
+ elow = READ_ONCE(memcg->memory.elow);
+ if (!elow || !READ_ONCE(memcg->memory.low))
+ return false;
+
+ return page_counter_read(&memcg->memory) <= elow;
}
static inline bool mem_cgroup_below_min(struct mem_cgroup *target,
struct mem_cgroup *memcg)
{
+ unsigned long emin;
+
if (mem_cgroup_unprotected(target, memcg))
return false;
- return READ_ONCE(memcg->memory.emin) >=
- page_counter_read(&memcg->memory);
+ emin = READ_ONCE(memcg->memory.emin);
+ if (!emin || !READ_ONCE(memcg->memory.min))
+ return false;
+
+ return page_counter_read(&memcg->memory) <= emin;
}
int __mem_cgroup_charge(struct folio *folio, struct mm_struct *mm, gfp_t gfp);
_
Patches currently in -mm which might be from longman@redhat.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-04-07 0:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 0:59 [to-be-updated] memcg-dont-generate-low-min-events-if-either-low-min-or-elow-emin-is-0.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.