cgroup: Refactor two assignments in css_task_iter_next_css_set()
PATCH 1/1 cgroup: Refactor two assignments in css_task_iter_next_css_set()
From: Wei Fenghai <zzuedu2000-9Onoh4P/[email protected]>
Combine two assignments for the variable ‘l’ into one statement.
--- kernel/cgroup/cgroup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/cgroup/cgroup.c +1 -2
@@ -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 ;
Signature · 1 line
2.17.1
Quoted 3 lines · On Sun, 2020-06-14 at 10:28 +0800, [email protected] wrote:
From: Wei Fenghai <[email protected]>
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
Quoted 2 lines · 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
Quoted 9 lines · On 2020/6/15 7:22, zzuedu2000-9Onoh4P/[email protected] wrote:
Quoted 2 lines · 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.