linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Stepanov Anatoly <stepanov.anatoly@huawei.com>
To: Johannes Weiner <hannes@cmpxchg.org>,
	<gutierrez.asier@huawei-partners.com>
Cc: <akpm@linux-foundation.org>, <david@redhat.com>,
	<ryan.roberts@arm.com>, <baohua@kernel.org>,
	<willy@infradead.org>, <peterx@redhat.com>, <hocko@kernel.org>,
	<roman.gushchin@linux.dev>, <shakeel.butt@linux.dev>,
	<muchun.song@linux.dev>, <cgroups@vger.kernel.org>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<alexander.kozhevnikov@huawei-partners.com>,
	<guohanjun@huawei.com>, <weiyongjun1@huawei.com>,
	<wangkefeng.wang@huawei.com>, <judy.chenhui@huawei.com>,
	<yusongping@huawei.com>, <artem.kuzin@huawei.com>,
	<kang.sun@huawei.com>
Subject: Re: [RFC PATCH 0/3] Cgroup-based THP control
Date: Fri, 1 Nov 2024 15:44:06 +0300	[thread overview]
Message-ID: <8e55d735-b65d-428f-8689-8f0b729d56c4@huawei.com> (raw)
In-Reply-To: <20241030150851.GB706616@cmpxchg.org>

On 10/30/2024 6:08 PM, Johannes Weiner wrote:
> On Wed, Oct 30, 2024 at 04:33:08PM +0800, gutierrez.asier@huawei-partners.com wrote:
>> From: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
>>
>> Currently THP modes are set globally. It can be an overkill if only some
>> specific app/set of apps need to get benefits from THP usage. Moreover, various
>> apps might need different THP settings. Here we propose a cgroup-based THP
>> control mechanism.
>>
>> THP interface is added to memory cgroup subsystem. Existing global THP control
>> semantics is supported for backward compatibility. When THP modes are set
>> globally all the changes are propagated to memory cgroups. However, when a
>> particular cgroup changes its THP policy, the global THP policy in sysfs remains
>> the same.
>>
>> New memcg files are exposed: memory.thp_enabled and memory.thp_defrag, which
>> have completely the same format as global THP enabled/defrag.
>>
>> Child cgroups inherit THP settings from parent cgroup upon creation. Particular
>> cgroup mode changes aren't propagated to child cgroups.

> 
> Cgroups are for hierarchical resource distribution. It's tempting to
> add parameters you would want for flat collections of processes, but
> it gets weird when it comes to inheritance and hiearchical semantics
> inside the cgroup tree - like it does here. So this is not a good fit.
> 
> On this particular issue, I agree with what Willy and David: let's not
> proliferate THP knobs; let's focus on making them truly transparent.

We're also thinking about THP-limit direction (as mentioned in cover-letter)
Just have per-cgroup THP-limit and only global THP knobs, with couple additional global modes
(always-cgroup/madvise-cgroup).

"always-cgroup" for instance would enable THP for those tasks
which are attached to non-root memcg.

Per-cgroup THP limit might be used in combination with global THP knobs,
and in this we can maintain hiearchical semantics.

Now it's just an idea, may be it's better to have another RFC patch-set for this,
to be able to have more productive conversation.


-- 
Anatoly Stepanov, Huawei


      reply	other threads:[~2024-11-01 12:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30  8:33 gutierrez.asier
2024-10-30  8:33 ` [RFC PATCH 1/3] mm: Add thp_flags control for cgroup gutierrez.asier
2024-10-30  8:33 ` [RFC PATCH 2/3] mm: Support for huge pages in cgroups gutierrez.asier
2024-10-30  8:33 ` [RFC PATCH 3/3] mm: Add thp_defrag control for cgroup gutierrez.asier
2024-10-30  8:38 ` [RFC PATCH 0/3] Cgroup-based THP control Michal Hocko
2024-10-30 12:51   ` Gutierrez Asier
2024-10-30 13:27     ` Michal Hocko
2024-10-30 14:58       ` Gutierrez Asier
2024-10-30 15:15         ` Michal Hocko
2024-10-31  6:06           ` Stepanov Anatoly
2024-10-31  8:33             ` Michal Hocko
2024-10-31 14:37               ` Stepanov Anatoly
2024-11-01  7:35                 ` Michal Hocko
2024-11-01 11:54                   ` Stepanov Anatoly
2024-11-01 13:15                     ` Michal Hocko
2024-11-01 13:24                       ` Stepanov Anatoly
2024-11-01 13:28                         ` Michal Hocko
2024-11-01 13:39                           ` Stepanov Anatoly
2024-11-01 13:50                             ` Michal Hocko
2024-11-01 14:03                               ` Stepanov Anatoly
2024-11-01 16:01                 ` Matthew Wilcox
2024-10-30 13:14 ` Matthew Wilcox
2024-10-30 13:16   ` David Hildenbrand
2024-10-30 14:45 ` Chris Down
2024-10-30 15:04   ` Michal Hocko
2024-10-30 15:08 ` Johannes Weiner
2024-11-01 12:44   ` Stepanov Anatoly [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=8e55d735-b65d-428f-8689-8f0b729d56c4@huawei.com \
    --to=stepanov.anatoly@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.kozhevnikov@huawei-partners.com \
    --cc=artem.kuzin@huawei.com \
    --cc=baohua@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=david@redhat.com \
    --cc=guohanjun@huawei.com \
    --cc=gutierrez.asier@huawei-partners.com \
    --cc=hannes@cmpxchg.org \
    --cc=hocko@kernel.org \
    --cc=judy.chenhui@huawei.com \
    --cc=kang.sun@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=peterx@redhat.com \
    --cc=roman.gushchin@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=shakeel.butt@linux.dev \
    --cc=wangkefeng.wang@huawei.com \
    --cc=weiyongjun1@huawei.com \
    --cc=willy@infradead.org \
    --cc=yusongping@huawei.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