From: "Li,Rongqing" <lirongqing@baidu.com>
To: Michal Hocko <mhocko@suse.com>, Shakeel Butt <shakeelb@google.com>
Cc: "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 02:31:13 +0000 [thread overview]
Message-ID: <cf7f485c3e7f4238b509d9dbbd084a2f@baidu.com> (raw)
In-Reply-To: <Y48aaCkgonOlMwNu@dhcp22.suse.cz>
> -----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.
> 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?
@@ -3498,7 +3499,11 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg,
continue;
}
- if (!try_to_free_mem_cgroup_pages(memcg, 1, GFP_KERNEL,
+ nr_pages = page_counter_read(counter);
+
+ nr_pages = nr_pages > (max + 1) ? (nr_pages - max) / 2 : 1;
+
+ if (!try_to_free_mem_cgroup_pages(memcg, nr_pages, GFP_KERNEL,
memsw ? 0 : MEMCG_RECLAIM_MAY_SWAP)) {
ret = -EBUSY;
break; thanks
thanks
-Li
next prev parent reply other threads:[~2022-12-07 2:32 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 [this message]
2022-12-07 12:18 ` Michal Hocko
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=cf7f485c3e7f4238b509d9dbbd084a2f@baidu.com \
--to=lirongqing@baidu.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.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).