Linux cgroups development
 help / color / mirror / Atom feed
From: Saket Kumar Bhaskar <skb99@linux.ibm.com>
To: Chen Ridong <chenridong@huawei.com>
Cc: tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org,
	longman@redhat.com, adityakali@google.com, sergeh@kernel.org,
	mkoutny@suse.com, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next 2/3] cgroup/cpuset: remove fetch_xcpus
Date: Mon, 19 Aug 2024 22:54:40 +0530	[thread overview]
Message-ID: <ZsN/2DBi3CyW9gis@linux.ibm.com> (raw)
In-Reply-To: <20240816082727.2779-3-chenridong@huawei.com>

On Fri, Aug 16, 2024 at 08:27:26AM +0000, Chen Ridong wrote:
> Both fetch_xcpus and user_xcpus functions are used to retrieve the value
> of exclusive_cpus. If exclusive_cpus is not set, cpus_allowed is the
> implicit value used as exclusive in a local partition. I can not imagine
> a scenario where effective_xcpus is not empty when exclusive_cpus is
> empty. Therefore, I suggest removing the fetch_xcpus function.
> 
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
>  kernel/cgroup/cpuset.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index fdd5346616d3..8be0259065f5 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -771,13 +771,6 @@ static inline bool xcpus_empty(struct cpuset *cs)
>  	       cpumask_empty(cs->exclusive_cpus);
>  }
>  
> -static inline struct cpumask *fetch_xcpus(struct cpuset *cs)
> -{
> -	return !cpumask_empty(cs->exclusive_cpus) ? cs->exclusive_cpus :
> -	       cpumask_empty(cs->effective_xcpus) ? cs->cpus_allowed
> -						  : cs->effective_xcpus;
> -}
> -
>  /*
>   * cpusets_are_exclusive() - check if two cpusets are exclusive
>   *
> @@ -785,8 +778,8 @@ static inline struct cpumask *fetch_xcpus(struct cpuset *cs)
>   */
>  static inline bool cpusets_are_exclusive(struct cpuset *cs1, struct cpuset *cs2)
>  {
> -	struct cpumask *xcpus1 = fetch_xcpus(cs1);
> -	struct cpumask *xcpus2 = fetch_xcpus(cs2);
> +	struct cpumask *xcpus1 = user_xcpus(cs1);
> +	struct cpumask *xcpus2 = user_xcpus(cs2);
>  
>  	if (cpumask_intersects(xcpus1, xcpus2))
>  		return false;
> @@ -2585,7 +2578,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
>  		invalidate = true;
>  		rcu_read_lock();
>  		cpuset_for_each_child(cp, css, parent) {
> -			struct cpumask *xcpus = fetch_xcpus(trialcs);
> +			struct cpumask *xcpus = user_xcpus(trialcs);
>  
>  			if (is_partition_valid(cp) &&
>  			    cpumask_intersects(xcpus, cp->effective_xcpus)) {
> -- 
> 2.34.1
> 

Hi,

In update_cpumask too fetch_xcpus is used. You may want to remove it from there too.

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 40ec4abaf440..1b4ee6403de6 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2587,7 +2587,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
                invalidate = true;
                rcu_read_lock();
                cpuset_for_each_child(cp, css, parent) {
-                       struct cpumask *xcpus = fetch_xcpus(trialcs);
+                       struct cpumask *xcpus = user_xcpus(trialcs);

                        if (is_partition_valid(cp) &&
                            cpumask_intersects(xcpus, cp->effective_xcpus)) {


Reviewed-by: Saket Kumar Bhaskar <skb99@linux.ibm.com> 

Thanks,
Saket

  reply	other threads:[~2024-08-19 17:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16  8:27 [PATCH -next 0/3] Some optimizations about cpuset Chen Ridong
2024-08-16  8:27 ` [PATCH -next 1/3] cgroup/cpuset: Correct invalid remote parition prs Chen Ridong
2024-08-19  2:14   ` Waiman Long
2024-08-19  2:18     ` Waiman Long
2024-08-19  6:25       ` chenridong
2024-08-16  8:27 ` [PATCH -next 2/3] cgroup/cpuset: remove fetch_xcpus Chen Ridong
2024-08-19 17:24   ` Saket Kumar Bhaskar [this message]
2024-08-19 18:28   ` Waiman Long
2024-08-16  8:27 ` [PATCH -next 3/3] cgroup/cpuset: remove use_parent_ecpus of cpuset Chen Ridong
2024-08-19 18:43   ` Waiman Long
2024-08-19 22:01 ` [PATCH -next 0/3] Some optimizations about cpuset Tejun Heo

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=ZsN/2DBi3CyW9gis@linux.ibm.com \
    --to=skb99@linux.ibm.com \
    --cc=adityakali@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.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