linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: "Li,Rongqing" <lirongqing@baidu.com>
Cc: Shakeel Butt <shakeelb@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"roman.gushchin@linux.dev" <roman.gushchin@linux.dev>,
	"songmuchun@bytedance.com" <songmuchun@bytedance.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: memcontrol: speedup memory cgroup resize
Date: Wed, 7 Dec 2022 13:18:18 +0100	[thread overview]
Message-ID: <Y5CEisw3waf2n3Gh@dhcp22.suse.cz> (raw)
In-Reply-To: <cf7f485c3e7f4238b509d9dbbd084a2f@baidu.com>

On Wed 07-12-22 02:31:13, Li,Rongqing wrote:
> 
> 
> > -----Original Message-----
> > From: Michal Hocko <mhocko@suse.com>
> > Sent: Tuesday, December 6, 2022 6:33 PM
> > To: Shakeel Butt <shakeelb@google.com>
> > Cc: Li,Rongqing <lirongqing@baidu.com>; linux-mm@kvack.org;
> > cgroups@vger.kernel.org; hannes@cmpxchg.org; roman.gushchin@linux.dev;
> > songmuchun@bytedance.com; akpm@linux-foundation.org
> > Subject: Re: [PATCH] mm: memcontrol: speedup memory cgroup resize
> > 
> > On Mon 05-12-22 08:32:41, Shakeel Butt wrote:
> > > On Mon, Dec 5, 2022 at 3:49 AM <lirongqing@baidu.com> wrote:
> > > >
> > > > From: Li RongQing <lirongqing@baidu.com>
> > > >
> > > > when resize memory cgroup, avoid to free memory cgroup page one by
> > > > one, and try to free needed number pages once
> > > >
> > >
> > > It's not really one by one but SWAP_CLUSTER_MAX. Also can you share
> > > some experiment results on how much this patch is improving setting
> > > limits?
> > 
> 
> If try to resize a cgroup to reclaim 50 Gb memory, and this cgroup has
> lots of children cgroups who are reading files and alloc memory, this
> patch can speed 2 or more times.

Do you have any more specific numbers including a perf profile to see
where the additional time is spent? I find 2 times speed up rather hard
to believe. The memory reclaim itself should be more CPU heavy than
additional function calls doing the same in batches.

Also is this an example of a realistic usecase?

> > Besides a clear performance gain you should also think about a potential over
> > reclaim when the limit is reduced by a lot (there might be parallel reclaimers
> > competing with the limit resize).
> > 
> 
> to avoid over claim,  how about to try to free half memory once?

We should really focus on why would a larger batch result in a
noticeably better performance.
-- 
Michal Hocko
SUSE Labs


      reply	other threads:[~2022-12-07 12:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 11:49 [PATCH] mm: memcontrol: speedup memory cgroup resize lirongqing
2022-12-05 16:32 ` Shakeel Butt
2022-12-06 10:33   ` Michal Hocko
2022-12-07  2:31     ` Li,Rongqing
2022-12-07 12:18       ` Michal Hocko [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=Y5CEisw3waf2n3Gh@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=lirongqing@baidu.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    /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;
as well as URLs for NNTP newsgroup(s).