* [PATCH] cgroup: minor tweak for logic to get cgroup css
@ 2019-07-03 2:07 Peng Wang
2019-07-08 16:42 ` Tejun Heo
2019-07-23 22:48 ` Tejun Heo
0 siblings, 2 replies; 5+ messages in thread
From: Peng Wang @ 2019-07-03 2:07 UTC (permalink / raw)
To: tj, lizefan, hannes; +Cc: cgroups, linux-kernel, Peng Wang
We could only handle the case that css exists
and css_try_get_online() fails.
Signed-off-by: Peng Wang <rocking@whu.edu.cn>
---
kernel/cgroup/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index bf9dbffd46b1..a988d77f6c6d 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -488,7 +488,7 @@ static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
rcu_read_lock();
css = cgroup_css(cgrp, ss);
- if (!css || !css_tryget_online(css))
+ if (css && !css_tryget_online(css))
css = NULL;
rcu_read_unlock();
--
2.19.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: minor tweak for logic to get cgroup css
2019-07-03 2:07 [PATCH] cgroup: minor tweak for logic to get cgroup css Peng Wang
@ 2019-07-08 16:42 ` Tejun Heo
2019-07-08 17:29 ` Roman Gushchin
2019-07-23 22:48 ` Tejun Heo
1 sibling, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2019-07-08 16:42 UTC (permalink / raw)
To: Peng Wang; +Cc: lizefan, hannes, cgroups, linux-kernel
On Wed, Jul 03, 2019 at 10:07:49AM +0800, Peng Wang wrote:
> We could only handle the case that css exists
> and css_try_get_online() fails.
As css_tryget_online() can't handle NULL input, this is a bug fix.
Can you please clarify that in the description?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: minor tweak for logic to get cgroup css
2019-07-08 16:42 ` Tejun Heo
@ 2019-07-08 17:29 ` Roman Gushchin
2019-07-08 17:31 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Roman Gushchin @ 2019-07-08 17:29 UTC (permalink / raw)
To: Tejun Heo; +Cc: Peng Wang, lizefan, hannes, cgroups, linux-kernel
On Mon, Jul 08, 2019 at 09:42:43AM -0700, Tejun Heo wrote:
> On Wed, Jul 03, 2019 at 10:07:49AM +0800, Peng Wang wrote:
> > We could only handle the case that css exists
> > and css_try_get_online() fails.
>
> As css_tryget_online() can't handle NULL input, this is a bug fix.
> Can you please clarify that in the description?
- if (!css || !css_tryget_online(css))
+ if (css && !css_tryget_online(css))
If css == NULL, !css is true, and the second part of the || statement
will not be evaluated. So it's not a bug fix.
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: minor tweak for logic to get cgroup css
2019-07-08 17:29 ` Roman Gushchin
@ 2019-07-08 17:31 ` Tejun Heo
0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2019-07-08 17:31 UTC (permalink / raw)
To: Roman Gushchin; +Cc: Peng Wang, lizefan, hannes, cgroups, linux-kernel
On Mon, Jul 08, 2019 at 05:29:49PM +0000, Roman Gushchin wrote:
> On Mon, Jul 08, 2019 at 09:42:43AM -0700, Tejun Heo wrote:
> > On Wed, Jul 03, 2019 at 10:07:49AM +0800, Peng Wang wrote:
> > > We could only handle the case that css exists
> > > and css_try_get_online() fails.
> >
> > As css_tryget_online() can't handle NULL input, this is a bug fix.
> > Can you please clarify that in the description?
>
> - if (!css || !css_tryget_online(css))
> + if (css && !css_tryget_online(css))
>
> If css == NULL, !css is true, and the second part of the || statement
> will not be evaluated. So it's not a bug fix.
Ah right, it's just confusing. Will apply after the merge window.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: minor tweak for logic to get cgroup css
2019-07-03 2:07 [PATCH] cgroup: minor tweak for logic to get cgroup css Peng Wang
2019-07-08 16:42 ` Tejun Heo
@ 2019-07-23 22:48 ` Tejun Heo
1 sibling, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2019-07-23 22:48 UTC (permalink / raw)
To: Peng Wang; +Cc: lizefan, hannes, cgroups, linux-kernel
On Wed, Jul 03, 2019 at 10:07:49AM +0800, Peng Wang wrote:
> We could only handle the case that css exists
> and css_try_get_online() fails.
>
> Signed-off-by: Peng Wang <rocking@whu.edu.cn>
Applied to cgroup/for-5.4.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-07-23 22:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 2:07 [PATCH] cgroup: minor tweak for logic to get cgroup css Peng Wang
2019-07-08 16:42 ` Tejun Heo
2019-07-08 17:29 ` Roman Gushchin
2019-07-08 17:31 ` Tejun Heo
2019-07-23 22:48 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).