[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e55d735-b65d-428f-8689-8f0b729d56c4@huawei.com>
Date: Fri, 1 Nov 2024 15:44:06 +0300
From: Stepanov Anatoly <stepanov.anatoly@...wei.com>
To: Johannes Weiner <hannes@...xchg.org>,
<gutierrez.asier@...wei-partners.com>
CC: <akpm@...ux-foundation.org>, <david@...hat.com>, <ryan.roberts@....com>,
<baohua@...nel.org>, <willy@...radead.org>, <peterx@...hat.com>,
<hocko@...nel.org>, <roman.gushchin@...ux.dev>, <shakeel.butt@...ux.dev>,
<muchun.song@...ux.dev>, <cgroups@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <alexander.kozhevnikov@...wei-partners.com>,
<guohanjun@...wei.com>, <weiyongjun1@...wei.com>,
<wangkefeng.wang@...wei.com>, <judy.chenhui@...wei.com>,
<yusongping@...wei.com>, <artem.kuzin@...wei.com>, <kang.sun@...wei.com>
Subject: Re: [RFC PATCH 0/3] Cgroup-based THP control
On 10/30/2024 6:08 PM, Johannes Weiner wrote:
> On Wed, Oct 30, 2024 at 04:33:08PM +0800, gutierrez.asier@...wei-partners.com wrote:
>> From: Asier Gutierrez <gutierrez.asier@...wei-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
Powered by blists - more mailing lists