From: Yafang Shao <laoar.shao@gmail.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH] mm, memcg: don't protect pages if memcg is not populated
Date: Mon, 25 Nov 2019 17:11:14 +0800 [thread overview]
Message-ID: <CALOAHbDTyBk0r-xHTNZLDbQqRJ4xapSanr9dnCv8DLyq8v277w@mail.gmail.com> (raw)
In-Reply-To: <20191125081446.GA31714@dhcp22.suse.cz>
On Mon, Nov 25, 2019 at 4:14 PM Michal Hocko <mhocko@kernel.org> wrote:
>
> On Sat 23-11-19 00:56:42, Yafang Shao wrote:
> > memory.{min, low} keeps protecting pages in a memcg even if there're no
> > process running in this memcg. That makes nonsense, because if there're
> > no processes running in this memcg there may be something wrong happens
> > and these protected pages are not useful now.
>
> Well, the min resp. low limits protect charges rather than tasks. And
> thre are cases when there is no direct relation between the charged
> memory and a specific task - e.g. long living kernel objects or page
> cache. So there is nothing really unusual to have charges in an absence
> of any tasks. I do not really see any reason why the protection
> shouldn't apply to them. Such a be behavior would be quite inconsistent
> btw. Just imagine a case when there is _a_ task but that one doesn't
> really have any charges in the memcg. Why should we respect reclaim
> protection in that case?
>
Per my understanding, the memory.{min, low} is used to protect the workload.
I don't know in which cases we protect the 'content' only.
If one memcg is used to protect the content only, e.g. some file
caches, then these file caches will be shared by processes in
different memcgs, that may cause some unexpected issues, for example,
how to handle the writeback throttle ?
I don't know how to use memory.{min, low} to protect long living
kernel objects neither without any processes.
I would appreciate if you could explain my questions in detail.
> Btw. offlined memcgs already have no min/low watermarks protect.
>
> Do you have any specific usecase that suffers from this behavior?
>
For example, if oom happens, the processes in this memcg may be killed
by OOM killer, and if memory.oom.group is set, all processes in it
will be killed. So these protected pages are useless. In that cases,
we should clear memory.{min, low} protection.
Thanks
Yafang
next prev parent reply other threads:[~2019-11-25 9:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 5:56 Yafang Shao
2019-11-25 8:14 ` Michal Hocko
2019-11-25 9:11 ` Yafang Shao [this message]
2019-11-25 9:38 ` 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=CALOAHbDTyBk0r-xHTNZLDbQqRJ4xapSanr9dnCv8DLyq8v277w@mail.gmail.com \
--to=laoar.shao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vdavydov.dev@gmail.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