linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: Refactor two assignments in css_task_iter_next_css_set()
@ 2020-06-14  2:28 zzuedu2000
  2020-06-14 18:10 ` James Bottomley
  0 siblings, 1 reply; 4+ messages in thread
From: zzuedu2000 @ 2020-06-14  2:28 UTC (permalink / raw)
  To: tj, lizefan, hannes
  Cc: cgroups, linux-kernel, Markus.Elfring, songmuchun, buddy.zhang,
	Wei Fenghai

From: Wei Fenghai <zzuedu2000@163.com>

Combine two assignments for the variable ‘l’ into one statement.

Signed-off-by: Wei Fenghai <zzuedu2000@163.com>
---
 kernel/cgroup/cgroup.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 1ea181a58465..c3e6db6e44d8 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4352,8 +4352,7 @@ static struct css_set *css_task_iter_next_css_set(struct css_task_iter *it)
 	}
 
 	/* find the next cset */
-	l = it->cset_pos;
-	l = l->next;
+	l = it->cset_pos->next;
 	if (l == it->cset_head) {
 		it->cset_pos = NULL;
 		return NULL;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Refactor two assignments in css_task_iter_next_css_set()
  2020-06-14  2:28 [PATCH] cgroup: Refactor two assignments in css_task_iter_next_css_set() zzuedu2000
@ 2020-06-14 18:10 ` James Bottomley
  2020-06-14 23:22   ` zzuedu2000
  0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2020-06-14 18:10 UTC (permalink / raw)
  To: zzuedu2000, tj, lizefan, hannes
  Cc: cgroups, linux-kernel, Markus.Elfring, songmuchun, buddy.zhang

On Sun, 2020-06-14 at 10:28 +0800, zzuedu2000@163.com wrote:
> From: Wei Fenghai <zzuedu2000@163.com>
> 
> Combine two assignments for the variable ‘l’ into one statement.

The problem with this commit message isn't the description, we can all
see what the change does, it's the justification.  Why is there any
reason to do this?  My version of gcc does this as an optimization
anyway, so the patch doesn't change to the binary output and it's
arguable that having two statements instead of one makes the code
marginally more readable.

Regards,

James


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Refactor two assignments in css_task_iter_next_css_set()
  2020-06-14 18:10 ` James Bottomley
@ 2020-06-14 23:22   ` zzuedu2000
  2020-06-15  1:11     ` Zefan Li
  0 siblings, 1 reply; 4+ messages in thread
From: zzuedu2000 @ 2020-06-14 23:22 UTC (permalink / raw)
  To: James.Bottomley
  Cc: tj, lizefan, hannes, cgroups, linux-kernel, Markus.Elfring,
	songmuchun, buddy.zhang

On Sun, 2020-06-14 at 18:10 +0800, James.Bottomley@xxxxxxx wrote:

> it's arguable that having two statements instead of one makes the code
> marginally more readable.

Above the function there is a similar line of code:
l = it->tcset_pos->next;
One line of code makes the code style consistent and more readable


Regards,

Wei Fenghai


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Refactor two assignments in css_task_iter_next_css_set()
  2020-06-14 23:22   ` zzuedu2000
@ 2020-06-15  1:11     ` Zefan Li
  0 siblings, 0 replies; 4+ messages in thread
From: Zefan Li @ 2020-06-15  1:11 UTC (permalink / raw)
  To: zzuedu2000, James.Bottomley
  Cc: tj, hannes, cgroups, linux-kernel, Markus.Elfring, songmuchun,
	buddy.zhang

On 2020/6/15 7:22, zzuedu2000@163.com wrote:
> On Sun, 2020-06-14 at 18:10 +0800, James.Bottomley@xxxxxxx wrote:
> 
>> it's arguable that having two statements instead of one makes the code
>> marginally more readable.
> 
> Above the function there is a similar line of code:
> l = it->tcset_pos->next;
> One line of code makes the code style consistent and more readable
> 

It would be much better if you are fixing a bug or developing a new feature
and while at it you do this cleanup conveniently, but this patch alone has
little value. 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-15  1:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14  2:28 [PATCH] cgroup: Refactor two assignments in css_task_iter_next_css_set() zzuedu2000
2020-06-14 18:10 ` James Bottomley
2020-06-14 23:22   ` zzuedu2000
2020-06-15  1:11     ` Zefan Li

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).