* [PATCH] sched/fair: Fix assignment of boolean variables
@ 2018-12-01 9:09 Wen Yang
2018-12-01 21:32 ` Joey Pabalinas
2018-12-03 8:33 ` Peter Zijlstra
0 siblings, 2 replies; 4+ messages in thread
From: Wen Yang @ 2018-12-01 9:09 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: linux-kernel, zhong.weidong, Wen Yang
Fix the following warnings reported by coccinelle:
kernel//sched/fair.c:7958:3-12: WARNING: Assignment of bool to 0/1
This also makes the code more readable.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
CC: Ingo Molnar <mingo@redhat.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: linux-kernel@vger.kernel.org
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a2e8160968cb..f19aa66f9b15 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7955,7 +7955,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
sgs->group_misfit_task_load < rq->misfit_task_load) {
sgs->group_misfit_task_load = rq->misfit_task_load;
- *overload = 1;
+ *overload = true;
}
}
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sched/fair: Fix assignment of boolean variables
2018-12-01 9:09 [PATCH] sched/fair: Fix assignment of boolean variables Wen Yang
@ 2018-12-01 21:32 ` Joey Pabalinas
2018-12-03 8:33 ` Peter Zijlstra
1 sibling, 0 replies; 4+ messages in thread
From: Joey Pabalinas @ 2018-12-01 21:32 UTC (permalink / raw)
To: Wen Yang
Cc: Ingo Molnar, Peter Zijlstra, linux-kernel, zhong.weidong, Joey Pabalinas
[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]
On Sat, Dec 01, 2018 at 05:09:36PM +0800, Wen Yang wrote:
> Fix the following warnings reported by coccinelle:
> kernel//sched/fair.c:7958:3-12: WARNING: Assignment of bool to 0/1
>
> This also makes the code more readable.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: Peter Zijlstra <peterz@infradead.org>
> CC: linux-kernel@vger.kernel.org
Ack, earlier assignments in the function like:
if (nr_running > 1)
*overload = true;
use `= true`, so this change keeps things consistent.
Reviewed-by: Joey Pabalinas <joeypabalinas@gmail.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a2e8160968cb..f19aa66f9b15 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7955,7 +7955,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
> if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
> sgs->group_misfit_task_load < rq->misfit_task_load) {
> sgs->group_misfit_task_load = rq->misfit_task_load;
> - *overload = 1;
> + *overload = true;
> }
> }
>
> --
> 2.19.1
>
--
Cheers,
Joey Pabalinas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched/fair: Fix assignment of boolean variables
2018-12-01 9:09 [PATCH] sched/fair: Fix assignment of boolean variables Wen Yang
2018-12-01 21:32 ` Joey Pabalinas
@ 2018-12-03 8:33 ` Peter Zijlstra
2018-12-03 10:03 ` Valentin Schneider
1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2018-12-03 8:33 UTC (permalink / raw)
To: Wen Yang; +Cc: Ingo Molnar, linux-kernel, zhong.weidong
On Sat, Dec 01, 2018 at 05:09:36PM +0800, Wen Yang wrote:
> Fix the following warnings reported by coccinelle:
> kernel//sched/fair.c:7958:3-12: WARNING: Assignment of bool to 0/1
>
> This also makes the code more readable.
I disagree; anybody that has trouble with 0/1 vs false/true needs to
stay away from C.
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: Peter Zijlstra <peterz@infradead.org>
> CC: linux-kernel@vger.kernel.org
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a2e8160968cb..f19aa66f9b15 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7955,7 +7955,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
> if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
> sgs->group_misfit_task_load < rq->misfit_task_load) {
> sgs->group_misfit_task_load = rq->misfit_task_load;
> - *overload = 1;
> + *overload = true;
> }
> }
>
Anyway, this code is going away anyway:
https://lkml.kernel.org/r/20181119141857.8625-12-quentin.perret@arm.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched/fair: Fix assignment of boolean variables
2018-12-03 8:33 ` Peter Zijlstra
@ 2018-12-03 10:03 ` Valentin Schneider
0 siblings, 0 replies; 4+ messages in thread
From: Valentin Schneider @ 2018-12-03 10:03 UTC (permalink / raw)
To: Peter Zijlstra, Wen Yang
Cc: Ingo Molnar, linux-kernel, zhong.weidong, Patrick Bellasi
On 03/12/2018 08:33, Peter Zijlstra wrote:
> On Sat, Dec 01, 2018 at 05:09:36PM +0800, Wen Yang wrote:
>> Fix the following warnings reported by coccinelle:
>> kernel//sched/fair.c:7958:3-12: WARNING: Assignment of bool to 0/1
>>
Duh, Patrick raised that one to me last week but I got caught up in other
things. I realized I could keep the local 'overload' as bool in
575638d1047e ("sched/core: Change root_domain->overload type to int")
but probably forgot to update
757ffdd705ee ("sched/fair: Set rq->rd->overload when misfit")
accordingly.
>> This also makes the code more readable.
>
> I disagree; anybody that has trouble with 0/1 vs false/true needs to
> stay away from C.
>
>> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
>> CC: Ingo Molnar <mingo@redhat.com>
>> CC: Peter Zijlstra <peterz@infradead.org>
>> CC: linux-kernel@vger.kernel.org
>> ---
>> kernel/sched/fair.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index a2e8160968cb..f19aa66f9b15 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -7955,7 +7955,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
>> if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
>> sgs->group_misfit_task_load < rq->misfit_task_load) {
>> sgs->group_misfit_task_load = rq->misfit_task_load;
>> - *overload = 1;
>> + *overload = true;
>> }
>> }
>>
>
> Anyway, this code is going away anyway:
>
> https://lkml.kernel.org/r/20181119141857.8625-12-quentin.perret@arm.com
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-03 10:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01 9:09 [PATCH] sched/fair: Fix assignment of boolean variables Wen Yang
2018-12-01 21:32 ` Joey Pabalinas
2018-12-03 8:33 ` Peter Zijlstra
2018-12-03 10:03 ` Valentin Schneider
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).