From: Chen Ridong <chenridong@huaweicloud.com>
To: Waiman Long <longman@redhat.com>,
tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org,
mkoutny@suse.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 -next 10/11] cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1
Date: Mon, 26 Aug 2024 20:53:14 +0800 [thread overview]
Message-ID: <153a238e-7b85-4334-9108-e665bcb233eb@huaweicloud.com> (raw)
In-Reply-To: <8aec8306-18aa-44af-81ba-dbb6ca9dcca0@redhat.com>
On 2024/8/26 10:18, Waiman Long wrote:
> On 8/25/24 21:34, Chen Ridong wrote:
>>
>>
>> On 2024/8/26 1:25, Waiman Long wrote:
>>> On 8/23/24 06:01, Chen Ridong wrote:
>>>> This patch introduces CONFIG_CPUSETS_V1 and guard cpuset-v1 code under
>>>> CONFIG_CPUSETS_V1. The default value of CONFIG_CPUSETS_V1 is N, so that
>>>> user who adopted v2 don't have 'pay' for cpuset v1.
>>>> Besides, to make code succinct, rename
>>>> '__cpuset_memory_pressure_bump()'
>>>> to 'cpuset_memory_pressure_bump()', and expose it to the world, which
>>>> takes place of the old mocro 'cpuset_memory_pressure_bump'.
>>>>
>>>> Signed-off-by: Chen Ridong <chenridong@huawei.com>
>>>> ---
>>>> include/linux/cpuset.h | 8 +-------
>>>> init/Kconfig | 13 +++++++++++++
>>>> kernel/cgroup/Makefile | 3 ++-
>>>> kernel/cgroup/cpuset-internal.h | 15 +++++++++++++++
>>>> kernel/cgroup/cpuset-v1.c | 10 ++++++----
>>>> kernel/cgroup/cpuset.c | 2 ++
>>>> 6 files changed, 39 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
>>>> index 2a6981eeebf8..f91f1f61f482 100644
>>>> --- a/include/linux/cpuset.h
>>>> +++ b/include/linux/cpuset.h
>>>> @@ -99,13 +99,7 @@ static inline bool cpuset_zone_allowed(struct
>>>> zone *z, gfp_t gfp_mask)
>>>> extern int cpuset_mems_allowed_intersects(const struct task_struct
>>>> *tsk1,
>>>> const struct task_struct *tsk2);
>>>> -#define cpuset_memory_pressure_bump() \
>>>> - do { \
>>>> - if (cpuset_memory_pressure_enabled) \
>>>> - __cpuset_memory_pressure_bump(); \
>>>> - } while (0)
>>>> -extern int cpuset_memory_pressure_enabled;
>>>> -extern void __cpuset_memory_pressure_bump(void);
>>>> +extern void cpuset_memory_pressure_bump(void);
>>>> extern void cpuset_task_status_allowed(struct seq_file *m,
>>>> struct task_struct *task);
>>>
>>> As you are introducing a new CONFIG_CPUSET_V1 kconfig option, you can
>>> use it to eliminate a useless function call if cgroup v1 isn't
>>> enabled. Not just this function, all the v1 specific functions should
>>> have a !CONFIG_CPUSET_V1 version that can be optimized out.
>>>
>>> Cheers,
>>> Longman
>>>
>>>
>> Hi, Longman, currently, we have only added one place to manage all the
>> functions whose are empty if !CONFIG_CPUSET_V1 is not defined , and
>> the caller does not need to care about using cpuset v1 or v2, which
>> makes it succinct.
>>
>> However, we have to add !CONFIG_CPUSET_V1 to many places to avoid
>> useless function calls. I am not opposed to do this if you thick it 'a
>> better implementation.
>
> You don't need to touch any files that use these cgroup v1 only
> functions. You only need to add some #ifdef code in the cpuset.h header
> file like
>
> #ifdef CONFIG_CPUSET_V1
> extern void cpuset_memory_pressure_bump(void);
> #else
> static inline void cpuset_memory_pressure_bump(void) { }
> #endif
>
> BTW, try not to introduce unnecessary performance regression. The reason
> cpuset_memory_pressure_bump() is a macro is to avoid a function call if
> cpuset_memory_pressure_enabled isn't set which is most likely case. It
> is cheaper to read a variable than do a function call.
>
> Cheers,
> Longman
>
>
>
>
Thank you for your patience, I just misunderstood.
I will do it in v2.
Best regards,
Ridong
next prev parent reply other threads:[~2024-08-26 12:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 10:00 [PATCH v1 -next 00/11] cgroup:cpuset:separate legacy cgroup v1 code and put under config option Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 01/11] cgroup/cpuset: introduce cpuset-v1.c Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 02/11] cgroup/cpuset: move common code to cpuset-internal.h Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 03/11] cgroup/cpuset: move memory_pressure to cpuset-v1.c Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 04/11] cgroup/cpuset: move relax_domain_level " Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 05/11] cgroup/cpuset: move memory_spread " Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 06/11] cgroup/cpuset: add callback_lock helper Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 07/11] cgroup/cpuset: move legacy hotplug update to cpuset-v1.c Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 08/11] cgroup/cpuset: move validate_change_legacy " Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 09/11] cgroup/cpuset: move v1 interfaces " Chen Ridong
2024-08-23 10:01 ` [PATCH v1 -next 10/11] cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1 Chen Ridong
2024-08-25 17:25 ` Waiman Long
2024-08-26 1:34 ` Chen Ridong
2024-08-26 2:18 ` Waiman Long
2024-08-26 12:53 ` Chen Ridong [this message]
2024-08-23 10:01 ` [PATCH v1 -next 11/11] cgroup/cpuset: add sefltest for cpuset v1 Chen Ridong
2024-08-25 17:20 ` [PATCH v1 -next 00/11] cgroup:cpuset:separate legacy cgroup v1 code and put under config option Waiman Long
2024-08-26 1:36 ` chenridong
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=153a238e-7b85-4334-9108-e665bcb233eb@huaweicloud.com \
--to=chenridong@huaweicloud.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=mkoutny@suse.com \
--cc=tj@kernel.org \
/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
all inboxes | Powered by JetHome®