lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eaef1faf-c3f3-4664-ae7d-5cca611925e4@redhat.com>
Date: Mon, 26 Aug 2024 15:30:14 -0400
From: Waiman Long <longman@...hat.com>
To: Chen Ridong <chenridong@...wei.com>, tj@...nel.org,
 lizefan.x@...edance.com, hannes@...xchg.org, adityakali@...gle.com,
 sergeh@...nel.org, mkoutny@...e.com
Cc: cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
 chenridong@...weicloud.com
Subject: Re: [PATCH v2 -next 09/11] cgroup/cpuset: move v1 interfaces to
 cpuset-v1.c

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@...wei.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ