public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Chen Ridong <chenridong@huawei.com>,
	tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org,
	adityakali@google.com, sergeh@kernel.org, mkoutny@suse.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	chenridong@huaweicloud.com
Subject: Re: [PATCH v2 -next 09/11] cgroup/cpuset: move v1 interfaces to cpuset-v1.c
Date: Mon, 26 Aug 2024 15:30:14 -0400	[thread overview]
Message-ID: <eaef1faf-c3f3-4664-ae7d-5cca611925e4@redhat.com> (raw)
In-Reply-To: <20240826132703.558956-10-chenridong@huawei.com>

On 8/26/24 09:27, Chen Ridong wrote:
> Move legacy cpuset controller interfaces files and corresponding code
> into cpuset-v1.c. 'update_flag', 'cpuset_write_resmask' and
> 'cpuset_common_seq_show' are also used for v1, so declare them in
> cpuset-internal.h.
>
> 'cpuset_write_s64', 'cpuset_read_s64' and 'fmeter_getrate' are only used
> cpuset-v1.c now, make it static.
>
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
>   kernel/cgroup/cpuset-internal.h |   9 +-
>   kernel/cgroup/cpuset-v1.c       | 194 ++++++++++++++++++++++++++++++-
>   kernel/cgroup/cpuset.c          | 195 +-------------------------------
>   3 files changed, 199 insertions(+), 199 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h
> index 07551ff0812e..a6c71c86e58d 100644
> --- a/kernel/cgroup/cpuset-internal.h
> +++ b/kernel/cgroup/cpuset-internal.h
> @@ -271,15 +271,16 @@ void callback_lock_irq(void);
>   void callback_unlock_irq(void);
>   void update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cpus);
>   void update_tasks_nodemask(struct cpuset *cs);
> +int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, int turning_on);
> +ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
> +				    char *buf, size_t nbytes, loff_t off);
> +int cpuset_common_seq_show(struct seq_file *sf, void *v);
>   
>   /*
>    * cpuset-v1.c
>    */
> +extern struct cftype legacy_files[];

The legacy_files name is rather generic. By making it globally visible 
within the kernel, it runs the risk conflicting with another variable of 
the same name (namespace pollution). I would suggest adding "cpuset_" 
prefix to make it unique to cpuset.

The following functions also have similar issue.

- update_flag()
- update_tasks_flags()
- validate_change_legacy()
- callback_lock_irq()
- callback_unlock_irq().

Another alternative is to include cpuset-v1.c directly into cpuset.c like

#ifdef CONFIG_CPUSETS_V1
#include "cpuset-v1.c"
#else
    ....
#endif

Then you don't need to change the names and will not need 
cpuset-internal.h. It is up to you to decide what you want to do.

Cheers,
Longman


  reply	other threads:[~2024-08-26 19:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 13:26 [PATCH v2 -next 00/11] cgroup:cpuset:separate legacy cgroup v1 code and put under config option Chen Ridong
2024-08-26 13:26 ` [PATCH v2 -next 01/11] cgroup/cpuset: introduce cpuset-v1.c Chen Ridong
2024-08-26 19:07   ` Waiman Long
2024-08-27  1:45     ` Chen Ridong
2024-08-26 13:26 ` [PATCH v2 -next 02/11] cgroup/cpuset: move common code to cpuset-internal.h Chen Ridong
2024-08-26 13:26 ` [PATCH v2 -next 03/11] cgroup/cpuset: move memory_pressure to cpuset-v1.c Chen Ridong
2024-08-26 13:26 ` [PATCH v2 -next 04/11] cgroup/cpuset: move relax_domain_level " Chen Ridong
2024-08-26 13:26 ` [PATCH v2 -next 05/11] cgroup/cpuset: move memory_spread " Chen Ridong
2024-08-26 13:26 ` [PATCH v2 -next 06/11] cgroup/cpuset: add callback_lock helper Chen Ridong
2024-08-26 13:26 ` [PATCH v2 -next 07/11] cgroup/cpuset: move legacy hotplug update to cpuset-v1.c Chen Ridong
2024-08-26 13:27 ` [PATCH v2 -next 08/11] cgroup/cpuset: move validate_change_legacy " Chen Ridong
2024-08-26 13:27 ` [PATCH v2 -next 09/11] cgroup/cpuset: move v1 interfaces " Chen Ridong
2024-08-26 19:30   ` Waiman Long [this message]
2024-08-26 19:40     ` Tejun Heo
2024-08-26 19:47       ` Waiman Long
2024-08-27  1:47         ` chenridong
2024-08-26 13:27 ` [PATCH v2 -next 10/11] cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1 Chen Ridong
2024-08-26 13:27 ` [PATCH v2 -next 11/11] cgroup/cpuset: add sefltest for cpuset v1 Chen Ridong

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=eaef1faf-c3f3-4664-ae7d-5cca611925e4@redhat.com \
    --to=longman@redhat.com \
    --cc=adityakali@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --cc=chenridong@huaweicloud.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mkoutny@suse.com \
    --cc=sergeh@kernel.org \
    --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