* [PATCH] cpuset: fix return value of cpuset_populate()
@ 2008-02-27 7:36 Li Zefan
2008-02-27 7:41 ` Paul Jackson
0 siblings, 1 reply; 5+ messages in thread
From: Li Zefan @ 2008-02-27 7:36 UTC (permalink / raw)
To: Andrew Morton; +Cc: Paul Jackson, LKML
- no need to check err == 0
- the last return value of cgroup_add_file() is ignored
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
kernel/cpuset.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 3e296ed..1c5b2d2 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1482,10 +1482,10 @@ static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont)
if ((err = cgroup_add_file(cont, ss, &cft_spread_slab)) < 0)
return err;
/* memory_pressure_enabled is in root cpuset only */
- if (err == 0 && !cont->parent)
+ if (!cont->parent)
err = cgroup_add_file(cont, ss,
&cft_memory_pressure_enabled);
- return 0;
+ return err;
}
/*
--
1.5.4.rc3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cpuset: fix return value of cpuset_populate()
2008-02-27 7:36 [PATCH] cpuset: fix return value of cpuset_populate() Li Zefan
@ 2008-02-27 7:41 ` Paul Jackson
2008-02-27 7:46 ` Li Zefan
2008-02-28 0:49 ` Paul Menage
0 siblings, 2 replies; 5+ messages in thread
From: Paul Jackson @ 2008-02-27 7:41 UTC (permalink / raw)
To: Li Zefan; +Cc: akpm, linux-kernel, Paul Menage
[Resending a patch that Li Zefan just sent, adding the other Paul (Menage)
to the CC list. -pj]
- no need to check err == 0
- the last return value of cgroup_add_file() is ignored
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
kernel/cpuset.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 3e296ed..1c5b2d2 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1482,10 +1482,10 @@ static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont)
if ((err = cgroup_add_file(cont, ss, &cft_spread_slab)) < 0)
return err;
/* memory_pressure_enabled is in root cpuset only */
- if (err == 0 && !cont->parent)
+ if (!cont->parent)
err = cgroup_add_file(cont, ss,
&cft_memory_pressure_enabled);
- return 0;
+ return err;
}
/*
--
1.5.4.rc3
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cpuset: fix return value of cpuset_populate()
2008-02-27 7:41 ` Paul Jackson
@ 2008-02-27 7:46 ` Li Zefan
2008-02-28 0:49 ` Paul Menage
1 sibling, 0 replies; 5+ messages in thread
From: Li Zefan @ 2008-02-27 7:46 UTC (permalink / raw)
To: Paul Jackson; +Cc: akpm, linux-kernel, Paul Menage
Paul Jackson wrote:
> [Resending a patch that Li Zefan just sent, adding the other Paul (Menage)
> to the CC list. -pj]
>
Thanks, I should have CCed Menage. :)
> - no need to check err == 0
> - the last return value of cgroup_add_file() is ignored
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
> kernel/cpuset.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> index 3e296ed..1c5b2d2 100644
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -1482,10 +1482,10 @@ static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont)
> if ((err = cgroup_add_file(cont, ss, &cft_spread_slab)) < 0)
> return err;
> /* memory_pressure_enabled is in root cpuset only */
> - if (err == 0 && !cont->parent)
> + if (!cont->parent)
> err = cgroup_add_file(cont, ss,
> &cft_memory_pressure_enabled);
> - return 0;
> + return err;
> }
>
> /*
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpuset: fix return value of cpuset_populate()
2008-02-27 7:41 ` Paul Jackson
2008-02-27 7:46 ` Li Zefan
@ 2008-02-28 0:49 ` Paul Menage
2008-02-28 1:06 ` Li Zefan
1 sibling, 1 reply; 5+ messages in thread
From: Paul Menage @ 2008-02-28 0:49 UTC (permalink / raw)
To: Paul Jackson; +Cc: Li Zefan, akpm, linux-kernel
On Tue, Feb 26, 2008 at 11:41 PM, Paul Jackson <pj@sgi.com> wrote:
>
> - no need to check err == 0
> - the last return value of cgroup_add_file() is ignored
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Looks fine from a cleanliness PoV, although since we don't actually do
anything with an error result from subsys->populate() (a behaviour
that I sort of inherited from cpusets ...) it won't make a whole lot
of difference to the code.
A better change would be to make cpuset_populate() use cgroup_add_files().
Paul
> ---
> kernel/cpuset.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> index 3e296ed..1c5b2d2 100644
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -1482,10 +1482,10 @@ static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont)
> if ((err = cgroup_add_file(cont, ss, &cft_spread_slab)) < 0)
> return err;
> /* memory_pressure_enabled is in root cpuset only */
> - if (err == 0 && !cont->parent)
> + if (!cont->parent)
> err = cgroup_add_file(cont, ss,
> &cft_memory_pressure_enabled);
> - return 0;
> + return err;
> }
>
> /*
> --
> 1.5.4.rc3
>
>
> --
> I won't rest till it's the best ...
> Programmer, Linux Scalability
> Paul Jackson <pj@sgi.com> 1.940.382.4214
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpuset: fix return value of cpuset_populate()
2008-02-28 0:49 ` Paul Menage
@ 2008-02-28 1:06 ` Li Zefan
0 siblings, 0 replies; 5+ messages in thread
From: Li Zefan @ 2008-02-28 1:06 UTC (permalink / raw)
To: Paul Menage; +Cc: Paul Jackson, akpm, linux-kernel
Paul Menage wrote:
> On Tue, Feb 26, 2008 at 11:41 PM, Paul Jackson <pj@sgi.com> wrote:
>> - no need to check err == 0
>> - the last return value of cgroup_add_file() is ignored
>>
>> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
>
> Looks fine from a cleanliness PoV, although since we don't actually do
> anything with an error result from subsys->populate() (a behaviour
> that I sort of inherited from cpusets ...) it won't make a whole lot
> of difference to the code.
>
> A better change would be to make cpuset_populate() use cgroup_add_files().
>
Yes, I'm considering this, and I will verify if this will save some bytes
in the object file.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-28 1:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27 7:36 [PATCH] cpuset: fix return value of cpuset_populate() Li Zefan
2008-02-27 7:41 ` Paul Jackson
2008-02-27 7:46 ` Li Zefan
2008-02-28 0:49 ` Paul Menage
2008-02-28 1:06 ` Li Zefan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox