linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: 台运方 <yunfangtai09@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>, Tejun Heo <tj@kernel.org>,
	 Cgroups <cgroups@vger.kernel.org>, Linux MM <linux-mm@kvack.org>
Subject: Re: [BUG] The usage of memory cgroup is not consistent with processes when using THP
Date: Tue, 28 Sep 2021 15:14:17 -0700	[thread overview]
Message-ID: <CAHbLzkpjRV_32V3AGCsDku8JckeFKvEWd=w2-ZkQ2hbcOAChAA@mail.gmail.com> (raw)
In-Reply-To: <CAHKqYaZAnz4wiHksKSZMLNEbk9eUUQ1z8iQCLwFgNW40ejByYQ@mail.gmail.com>

On Tue, Sep 28, 2021 at 12:15 AM 台运方 <yunfangtai09@gmail.com> wrote:
>
> Yang Shi <shy828301@gmail.com> 于2021年9月28日周二 上午1:28写道:
> > IMHO I don't think this is a bug. The disparity reflects the
> > difference in how the page life cycle is viewed between process and
> > cgroup. The usage of process comes from the rss_counter of mm. It
> > tracks the per-process mapped memory usage. So it is updated once the
> > page is zapped.
> >
> > But from the point of cgroup, the page is charged when it is allocated
> > and uncharged when it is freed. The page may be zapped by one process,
> > but there might be other users pin the page to prevent it from being
> > freed. The pin may be very transient or may be indefinite. THP is one
> > of the pins. It is gone when the THP is split, but the split may
> > happen a long time after the page is zapped due to deferred split.
> Thank you for reply. I agree that it reflects the difference between
> process and cgroup. The memory usage of cgroup is usually used to
> indicate the memory usage of the container. It can be used to avoid
> the OOM and etc. The disparity will cause that the memory usage of
> containers with the same processes are randomly different (we found
> more than 30GB different). It is hard to manage them. Of course,
> disable THP is a way to solve it. Can it have another way to solve it
> ?

I don't quite get what exactly you want to manage. If you want to get
rid of the disparity, I don't have good idea other than splitting THP
in place instead of using deferred split. But AFAIK it is not quite
feasible due to some locking problems.


  reply	other threads:[~2021-09-28 22:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26  7:35 台运方
2021-09-27 17:28 ` Yang Shi
2021-09-28  7:15   ` 台运方
2021-09-28 22:14     ` Yang Shi [this message]
2021-09-29  3:25       ` Yunfang Tai

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='CAHbLzkpjRV_32V3AGCsDku8JckeFKvEWd=w2-ZkQ2hbcOAChAA@mail.gmail.com' \
    --to=shy828301@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=tj@kernel.org \
    --cc=yunfangtai09@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