Skip to content

Commit

Permalink
cgroup/cpuset: Remove unneeded goto in sched_partition_write() and re…
Browse files Browse the repository at this point in the history
…name it

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>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Waiman Long authored and Tejun Heo committed Mar 31, 2025
1 parent f0a0bd3 commit 52e039f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions kernel/cgroup/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand All @@ -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);
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 52e039f

Please sign in to comment.