public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: "Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Shuah Khan" <shuah@kernel.org>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, Waiman Long <longman@redhat.com>
Subject: [PATCH 07/10] cgroup/cpuset: Remove unneeded goto in sched_partition_write() and rename it
Date: Sun, 30 Mar 2025 17:52:45 -0400	[thread overview]
Message-ID: <20250330215248.3620801-8-longman@redhat.com> (raw)
In-Reply-To: <20250330215248.3620801-1-longman@redhat.com>

The goto statement in sched_partition_write() is not needed. Remove
it and rename sched_partition_write()/sched_partition_show() to
cpuset_partition_write()/cpuset_partition_show().

Signed-off-by: Waiman Long <longman@redhat.com>
---
 kernel/cgroup/cpuset.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index aa529b2dbf56..306b60430091 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -3272,7 +3272,7 @@ int cpuset_common_seq_show(struct seq_file *sf, void *v)
 	return ret;
 }
 
-static int sched_partition_show(struct seq_file *seq, void *v)
+static int cpuset_partition_show(struct seq_file *seq, void *v)
 {
 	struct cpuset *cs = css_cs(seq_css(seq));
 	const char *err, *type = NULL;
@@ -3303,7 +3303,7 @@ static int sched_partition_show(struct seq_file *seq, void *v)
 	return 0;
 }
 
-static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf,
+static ssize_t cpuset_partition_write(struct kernfs_open_file *of, char *buf,
 				     size_t nbytes, loff_t off)
 {
 	struct cpuset *cs = css_cs(of_css(of));
@@ -3324,11 +3324,8 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf,
 	css_get(&cs->css);
 	cpus_read_lock();
 	mutex_lock(&cpuset_mutex);
-	if (!is_cpuset_online(cs))
-		goto out_unlock;
-
-	retval = update_prstate(cs, val);
-out_unlock:
+	if (is_cpuset_online(cs))
+		retval = update_prstate(cs, val);
 	mutex_unlock(&cpuset_mutex);
 	cpus_read_unlock();
 	css_put(&cs->css);
@@ -3372,8 +3369,8 @@ static struct cftype dfl_files[] = {
 
 	{
 		.name = "cpus.partition",
-		.seq_show = sched_partition_show,
-		.write = sched_partition_write,
+		.seq_show = cpuset_partition_show,
+		.write = cpuset_partition_write,
 		.private = FILE_PARTITION_ROOT,
 		.flags = CFTYPE_NOT_ON_ROOT,
 		.file_offset = offsetof(struct cpuset, partition_file),
-- 
2.48.1


  parent reply	other threads:[~2025-03-30 21:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-30 21:52 [PATCH 00/10] cgroup/cpuset: Miscellaneous partition bug fixes and enhancements Waiman Long
2025-03-30 21:52 ` [PATCH 01/10] cgroup/cpuset: Fix race between newly created partition and dying one Waiman Long
2025-03-31 23:13   ` Tejun Heo
2025-04-01  3:12     ` Waiman Long
2025-04-01 19:59       ` Tejun Heo
2025-04-01 20:41         ` Waiman Long
2025-04-01 20:56           ` Waiman Long
2025-04-02  7:49   ` Tejun Heo
2025-04-03 13:34     ` Michal Koutný
2025-04-03 16:15       ` Tejun Heo
2025-03-30 21:52 ` [PATCH 02/10] cgroup/cpuset: Fix incorrect isolated_cpus update in update_parent_effective_cpumask() Waiman Long
2025-03-30 21:52 ` [PATCH 03/10] cgroup/cpuset: Fix error handling in remote_partition_disable() Waiman Long
2025-03-30 21:52 ` [PATCH 04/10] cgroup/cpuset: Remove remote_partition_check() & make update_cpumasks_hier() handle remote partition Waiman Long
2025-03-30 21:52 ` [PATCH 05/10] cgroup/cpuset: Don't allow creation of local partition over a remote one Waiman Long
2025-04-03 13:33   ` Michal Koutný
2025-04-03 13:48     ` Waiman Long
2025-03-30 21:52 ` [PATCH 06/10] cgroup/cpuset: Code cleanup and comment update Waiman Long
2025-03-30 21:52 ` Waiman Long [this message]
2025-04-03 13:33   ` [PATCH 07/10] cgroup/cpuset: Remove unneeded goto in sched_partition_write() and rename it Michal Koutný
2025-04-03 13:49     ` Waiman Long
2025-03-30 21:52 ` [PATCH 08/10] selftest/cgroup: Update test_cpuset_prs.sh to use | as effective CPUs and state separator Waiman Long
2025-03-30 21:52 ` [PATCH 09/10] selftest/cgroup: Clean up and restructure test_cpuset_prs.sh Waiman Long
2025-03-30 21:52 ` [PATCH 10/10] selftest/cgroup: Add a remote partition transition test to test_cpuset_prs.sh Waiman Long
2025-03-31 23:28   ` 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=20250330215248.3620801-8-longman@redhat.com \
    --to=longman@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=shuah@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