[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <770bf300-1dbb-42fc-8958-b9307486178e@huawei-partners.com>
Date: Wed, 30 Oct 2024 15:51:00 +0300
From: Gutierrez Asier <gutierrez.asier@...wei-partners.com>
To: Michal Hocko <mhocko@...e.com>
CC: <akpm@...ux-foundation.org>, <david@...hat.com>, <ryan.roberts@....com>,
<baohua@...nel.org>, <willy@...radead.org>, <peterx@...hat.com>,
<hannes@...xchg.org>, <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>,
<stepanov.anatoly@...wei.com>, <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 11:38 AM, Michal Hocko wrote:
> On Wed 30-10-24 16:33:08, 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.
>
> Do you have any specific examples where this would be benefitial?
Now we're mostly focused on database scenarios (MySQL, Redis).
The main idea is to avoid using a global THP setting that can potentially waste
overall resource and have per cgroup granularity.
Besides THP are being beneficial for DB performance, we observe high THP
"over-usage" by some unrelated apps/services, when "always" mode is enabled
globally.
With cgroup-THP, we're able to specify exact "THP-users", and plan to introduce
an ability to limit the amount of THPs per-cgroup.
We suppose it should be beneficial for some container-based workloads, when
certain containers can have different THP-policies, but haven't looked into
this case yet.
>> 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.
>
> So this breaks hierarchical property, doesn't it? In other words if a
> parent cgroup would like to enforce a certain policy to all descendants
> then this is not really possible.
The first idea was to have some flexibility when changing THP policies.
I will submit a new patch set which will enforce the cgroup hierarchy and change all
the children recursively.
--
Asier Gutierrez
Huawei
Powered by blists - more mailing lists