public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>
To: Zhaoyang Huang <huangzhaoyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Suren Baghdasaryan
	<surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"zhaoyang.huang"
	<zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Vladimir Davydov
	<vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"open list:MEMORY MANAGEMENT"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	cgroups mailinglist
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Ke Wang <ke.wang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>
Subject: Re: [RFC PATCH] cgroup: introduce dynamic protection for memcg
Date: Mon, 4 Apr 2022 11:36:33 +0200	[thread overview]
Message-ID: <Ykq8IXstIKoW8JE2@dhcp22.suse.cz> (raw)
In-Reply-To: <Ykq7KUleuAg5QnNU-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>

On Mon 04-04-22 11:32:28, Michal Hocko wrote:
> On Mon 04-04-22 17:23:43, Zhaoyang Huang wrote:
> > On Mon, Apr 4, 2022 at 5:07 PM Zhaoyang Huang <huangzhaoyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > >
> > > On Mon, Apr 4, 2022 at 4:51 PM Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org> wrote:
> > > >
> > > > On Mon 04-04-22 10:33:58, Zhaoyang Huang wrote:
> > > > [...]
> > > > > > One thing that I don't understand in this approach is: why memory.low
> > > > > > should depend on the system's memory pressure. It seems you want to
> > > > > > allow a process to allocate more when memory pressure is high. That is
> > > > > > very counter-intuitive to me. Could you please explain the underlying
> > > > > > logic of why this is the right thing to do, without going into
> > > > > > technical details?
> > > > > What I want to achieve is make memory.low be positive correlation with
> > > > > timing and negative to memory pressure, which means the protected
> > > > > memcg should lower its protection(via lower memcg.low) for helping
> > > > > system's memory pressure when it's high.
> > > >
> > > > I have to say this is still very confusing to me. The low limit is a
> > > > protection against external (e.g. global) memory pressure. Decreasing
> > > > the protection based on the external pressure sounds like it goes right
> > > > against the purpose of the knob. I can see reasons to update protection
> > > > based on refaults or other metrics from the userspace but I still do not
> > > > see how this is a good auto-magic tuning done by the kernel.
> > > >
> > > > > The concept behind is memcg's
> > > > > fault back of dropped memory is less important than system's latency
> > > > > on high memory pressure.
> > > >
> > > > Can you give some specific examples?
> > > For both of the above two comments, please refer to the latest test
> > > result in Patchv2 I have sent. I prefer to name my change as focus
> > > transfer under pressure as protected memcg is the focus when system's
> > > memory pressure is low which will reclaim from root, this is not
> > > against current design. However, when global memory pressure is high,
> > > then the focus has to be changed to the whole system, because it
> > > doesn't make sense to let the protected memcg out of everybody, it
> > > can't
> > > do anything when the system is trapped in the kernel with reclaiming work.
> > Does it make more sense if I describe the change as memcg will be
> > protect long as system pressure is under the threshold(partially
> > coherent with current design) and will sacrifice the memcg if pressure
> > is over the threshold(added change)
> 
> No, not really. For one it is still really unclear why there should be any
> difference in the semantic between global and external memory pressure
> in general. The low limit is always a protection from the external
> pressure. And what should be the actual threshold? Amount of the reclaim
> performed, effectivness of the reclaim or what?

Btw. you might want to have a look at http://lkml.kernel.org/r/20220331084151.2600229-1-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
where a new interface to allow pro-active memory reclaim is discussed.
I think that this might turn out to be a better fit then an automagic
kernel manipulation with a low limit. It will require a user agent to
drive the reclaim though.
-- 
Michal Hocko
SUSE Labs

  parent reply	other threads:[~2022-04-04  9:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31  8:00 [RFC PATCH] cgroup: introduce dynamic protection for memcg zhaoyang.huang
     [not found] ` <1648713656-24254-1-git-send-email-zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>
2022-03-31  9:01   ` Michal Hocko
     [not found]     ` <YkVt0m+VxnXgnulq-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-03-31 11:18       ` Zhaoyang Huang
     [not found]         ` <CAGWkznF4qb2EP3=xVamKO8qk08vaFg9JeHD7g80xvBfxm39Hkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-03-31 11:35           ` Michal Hocko
     [not found]             ` <YkWR8t8yEe6xyzCM-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-03-31 19:26               ` Suren Baghdasaryan
     [not found]                 ` <CAJuCfpFgi+Dph-dcDAvGQXwgeZVDBhok1UQ3X5kxFEfPQnxSSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-01  1:51                   ` Zhaoyang Huang
     [not found]                     ` <CAGWkznHyAG1wZcUrGE4-amptT_MkSnpZCrDLy0vUWBm3z2cmJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-01  4:46                       ` Suren Baghdasaryan
     [not found]                         ` <CAJuCfpEyDqiB2a+KqC1+Un0UJB1m3c0Aej6y3Umna3fdCPhvaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-02  3:21                           ` Zhaoyang Huang
2022-04-01  1:34               ` Zhaoyang Huang
     [not found]                 ` <CAGWkznHxAD0757m1i1Csw1CVRDtQddfCL08dYf12fa47=-uYYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-01 11:34                   ` Michal Hocko
     [not found]                     ` <YkbjNYMY8VjHoSHR-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-04-02  5:18                       ` Zhaoyang Huang
     [not found]                         ` <CAGWkznF7cSyPU0ceYwH6zweJzf-X1bQnS6AJ2-J+WEL0u8jzng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-03 15:04                           ` Suren Baghdasaryan
     [not found]                             ` <CAJuCfpHneDZMXO_MmQDPA+igAOdAPRUChiq+zftFXGfDzPHNhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-04  2:33                               ` Zhaoyang Huang
     [not found]                                 ` <CAGWkznFTQCm0cusVxA_55fu2WfT-w2coVHrT=JA1D_9_2728mQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-04  8:51                                   ` Michal Hocko
     [not found]                                     ` <YkqxpEW4m6iU3zMq-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-04-04  9:07                                       ` Zhaoyang Huang
     [not found]                                         ` <CAGWkznG4L3w=9bpZp8TjyWHmqFyZQk-3m4xCZ96zhHCLPawBgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-04  9:23                                           ` Zhaoyang Huang
     [not found]                                             ` <CAGWkznGMRohE2_at4Qh8KbwSqNmNqOAG2N1EM+7uE9wKqzRm0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-04  9:32                                               ` Michal Hocko
     [not found]                                                 ` <Ykq7KUleuAg5QnNU-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-04-04  9:36                                                   ` Michal Hocko [this message]
2022-04-04 11:35                                                     ` Zhaoyang Huang
2022-04-04 11:23                                                   ` Zhaoyang Huang
     [not found]                                                     ` <CAGWkznGbd5TOTHZE8uUhak3SnHqEWx_9QCJVtUFUSg9rk3xYEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-04 12:29                                                       ` Michal Hocko
     [not found]                                                         ` <Ykrkx4JML4c81gBV-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-04-04 13:14                                                           ` Zhaoyang Huang
     [not found]                                                             ` <CAGWkznEaEavCz9GeiYuTqsox2qZK43iQKevt8njkzaHv6KiW-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-05 12:08                                                               ` Michal Hocko
     [not found]                                                                 ` <YkwxNaJIg6ptJOYT-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-04-06  2:11                                                                   ` Zhaoyang Huang
     [not found]                                                                     ` <CAGWkznG=QH3HRSzgum0sQBkyQAahqgiWf8nXCv1qXstxrn7e8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-07  7:40                                                                       ` Michal Hocko
2022-04-07  8:59                                                                         ` Zhaoyang Huang
     [not found]                                                                           ` <CAGWkznG+V88f_DjtJAe4_Nr=32Q7Z4b1CaBCB0FVqhAAsuNsWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-07  9:44                                                                             ` Michal Hocko
     [not found]                                                                               ` <Yk6ya5Ks0H6rHPx4-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-04-07 12:36                                                                                 ` Zhaoyang Huang
     [not found]                                                                                   ` <CAGWkznH1NhfDXy94cOs0YWnw_uOOVbcbrygT5X6CAZ44CTf78Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-04-07 14:14                                                                                     ` Michal Hocko
2022-04-06  8:21                                                                   ` Zhaoyang Huang

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=Ykq8IXstIKoW8JE2@dhcp22.suse.cz \
    --to=mhocko-ibi9rg/b67k@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=huangzhaoyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ke.wang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.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