mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <muchun.song@linux.dev>, Tejun Heo <tj@kernel.org>,
	Harry Yoo <harry@kernel.org>,
	Meta kernel team <kernel-team@meta.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/5] memcg: force charges from reclaim before trying the limits
Date: Tue, 3 Nov 2026 09:34:33 +0100	[thread overview]
Message-ID: <aumcmb9iBpovh97u@tiehlicka> (raw)
In-Reply-To: <auli2Zlf1F0tyi4X@linux.dev>

On Mon 02-11-26 20:34:40, Shakeel Butt wrote:
> On Mon, Nov 02, 2026 at 09:46:38AM +0100, Michal Hocko wrote:
[...]
> > @@ -2789,6 +2779,15 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
> >  	if (do_memsw_account())
> >  		page_counter_charge(&memcg->memsw, nr_pages);
> >  
> > +	/*
> > +	 * If the allocation has to be enforced, don't forget to raise
> > +	 * a MEMCG_MAX event.
> > +	 */
> > +	for (mem_over_limit = memcg; mem_over_limit;
> > +	     mem_over_limit = parent_mem_cgroup(mem_over_limit))
> > +		if (!mem_cgroup_margin(mem_over_limit))
> 
> Second, !mem_cgroup_margin() is true at usage == max, so a charge that fits
> exactly raises an event (unlike today).

True

> 
> > +			__memcg_memory_event(mem_over_limit, MEMCG_MAX, allow_spinning);
> 
> Third, we definitely need a break here otherwise every ancestor at its limit gets
> an event which does not happen today.

This is a separate thing but shouldn't we actually raise the event on
all levels that are over?

> I want to keep my current version.

OK, fair enough. My intention was to have those two parts closer
together but this is not something I would insist.

Acked-by: Michal Hocko <mhocko@sus.com>
Thanks!

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2026-11-03  8:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 20:54 [PATCH v2 0/5] memcg: clean up memory.high enforcement Shakeel Butt
2026-10-30 20:54 ` [PATCH v2 1/5] memcg: move memory.high enforcement out of try_charge_memcg() Shakeel Butt
2026-10-31  0:45   ` Muchun Song
2026-10-30 20:54 ` [PATCH v2 2/5] memcg: force charges from reclaim before trying the limits Shakeel Butt
2026-10-31  0:46   ` Muchun Song
2026-11-02  8:46   ` Michal Hocko
2026-11-03  4:34     ` Shakeel Butt
2026-11-03  8:34       ` Michal Hocko [this message]
2026-10-30 20:54 ` [PATCH v2 3/5] memcg: use high_work for kernel threads Shakeel Butt
2026-10-31  0:47   ` Muchun Song
2026-10-30 20:54 ` [PATCH v2 4/5] memcg: use high_work for remote charges Shakeel Butt
2026-10-31  0:48   ` Muchun Song
2026-10-30 20:54 ` [PATCH v2 5/5] memcg: simplify high limit handling after a charge 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=aumcmb9iBpovh97u@tiehlicka \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=harry@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®