linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type
@ 2021-11-18 14:14 Vincent Donnefort
  2021-11-18 14:14 ` [PATCH v2 2/2] sched/fair: Fix task_fits_capacity() capacity type Vincent Donnefort
  2021-12-06 15:20 ` [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type Peter Zijlstra
  0 siblings, 2 replies; 5+ messages in thread
From: Vincent Donnefort @ 2021-11-18 14:14 UTC (permalink / raw)
  To: peterz, mingo, vincent.guittot
  Cc: linux-kernel, dietmar.eggemann, valentin.schneider, Vincent Donnefort

task_util is an unsigned long value, compared with a CPU capacity which is
unsigned long as well. There's no need for an intermediate implicit int
cast.

Fixes: b4c9c9f15649 ("sched/fair: Prefer prev cpu in asymmetric wakeup path")
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 945d987246c5..8fde6e10e24b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6346,7 +6346,7 @@ select_idle_capacity(struct task_struct *p, struct sched_domain *sd, int target)
 	return best_cpu;
 }
 
-static inline bool asym_fits_capacity(int task_util, int cpu)
+static inline bool asym_fits_capacity(unsigned long task_util, int cpu)
 {
 	if (static_branch_unlikely(&sched_asym_cpucapacity))
 		return fits_capacity(task_util, capacity_of(cpu));
-- 
2.25.1


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

* [PATCH v2 2/2] sched/fair: Fix task_fits_capacity() capacity type
  2021-11-18 14:14 [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type Vincent Donnefort
@ 2021-11-18 14:14 ` Vincent Donnefort
  2021-11-23  8:38   ` Vincent Guittot
  2021-12-06 15:20 ` [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type Peter Zijlstra
  1 sibling, 1 reply; 5+ messages in thread
From: Vincent Donnefort @ 2021-11-18 14:14 UTC (permalink / raw)
  To: peterz, mingo, vincent.guittot
  Cc: linux-kernel, dietmar.eggemann, valentin.schneider, Vincent Donnefort

capacity is an unsigned long value, compared with a task utilization which
is unsigned long as well. There's no need for an intermediate implicit
long cast.

Fixes: 3b1baa6496e6 ("sched/fair: Add 'group_misfit_task' load-balance type")
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8fde6e10e24b..26a88975f68a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4070,7 +4070,8 @@ static inline void util_est_update(struct cfs_rq *cfs_rq,
 	trace_sched_util_est_se_tp(&p->se);
 }
 
-static inline int task_fits_capacity(struct task_struct *p, long capacity)
+static inline int task_fits_capacity(struct task_struct *p,
+				     unsigned long capacity)
 {
 	return fits_capacity(uclamp_task_util(p), capacity);
 }
-- 
2.25.1


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

* Re: [PATCH v2 2/2] sched/fair: Fix task_fits_capacity() capacity type
  2021-11-18 14:14 ` [PATCH v2 2/2] sched/fair: Fix task_fits_capacity() capacity type Vincent Donnefort
@ 2021-11-23  8:38   ` Vincent Guittot
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Guittot @ 2021-11-23  8:38 UTC (permalink / raw)
  To: Vincent Donnefort
  Cc: peterz, mingo, linux-kernel, dietmar.eggemann, Valentin.Schneider

On Thu, 18 Nov 2021 at 15:15, Vincent Donnefort
<vincent.donnefort@arm.com> wrote:
>
> capacity is an unsigned long value, compared with a task utilization which
> is unsigned long as well. There's no need for an intermediate implicit
> long cast.
>
> Fixes: 3b1baa6496e6 ("sched/fair: Add 'group_misfit_task' load-balance type")
> Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>

Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 8fde6e10e24b..26a88975f68a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4070,7 +4070,8 @@ static inline void util_est_update(struct cfs_rq *cfs_rq,
>         trace_sched_util_est_se_tp(&p->se);
>  }
>
> -static inline int task_fits_capacity(struct task_struct *p, long capacity)
> +static inline int task_fits_capacity(struct task_struct *p,
> +                                    unsigned long capacity)
>  {
>         return fits_capacity(uclamp_task_util(p), capacity);
>  }
> --
> 2.25.1
>

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

* Re: [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type
  2021-11-18 14:14 [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type Vincent Donnefort
  2021-11-18 14:14 ` [PATCH v2 2/2] sched/fair: Fix task_fits_capacity() capacity type Vincent Donnefort
@ 2021-12-06 15:20 ` Peter Zijlstra
  2021-12-07  9:48   ` Vincent Donnefort
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2021-12-06 15:20 UTC (permalink / raw)
  To: Vincent Donnefort
  Cc: mingo, vincent.guittot, linux-kernel, dietmar.eggemann,
	valentin.schneider

On Thu, Nov 18, 2021 at 02:14:10PM +0000, Vincent Donnefort wrote:
> task_util is an unsigned long value, compared with a CPU capacity which is
> unsigned long as well. There's no need for an intermediate implicit int
> cast.
> 
> Fixes: b4c9c9f15649 ("sched/fair: Prefer prev cpu in asymmetric wakeup path")

Do either of these patches actually *fix* anything? Afaict they're an
absolute no-op, even in terms of code-gen due to the promotion rules.

Yes, its arguably nicer to not rely on those implicit promotions etc..
but I don't think this warrants a Fixes tag or even being split in two
patches.

Hmm?

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

* Re: [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type
  2021-12-06 15:20 ` [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type Peter Zijlstra
@ 2021-12-07  9:48   ` Vincent Donnefort
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Donnefort @ 2021-12-07  9:48 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: mingo, vincent.guittot, linux-kernel, dietmar.eggemann,
	valentin.schneider

On Mon, Dec 06, 2021 at 04:20:04PM +0100, Peter Zijlstra wrote:
> On Thu, Nov 18, 2021 at 02:14:10PM +0000, Vincent Donnefort wrote:
> > task_util is an unsigned long value, compared with a CPU capacity which is
> > unsigned long as well. There's no need for an intermediate implicit int
> > cast.
> > 
> > Fixes: b4c9c9f15649 ("sched/fair: Prefer prev cpu in asymmetric wakeup path")
> 
> Do either of these patches actually *fix* anything? Afaict they're an
> absolute no-op, even in terms of code-gen due to the promotion rules.
> 
> Yes, its arguably nicer to not rely on those implicit promotions etc..
> but I don't think this warrants a Fixes tag or even being split in two
> patches.
> 
> Hmm?

As far as I know it doesn't change anything functionally speaking. So yeah,
let's consider it as a cleanup. I'll merge the changes and drop the Fix tag.

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

end of thread, other threads:[~2021-12-07  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 14:14 [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type Vincent Donnefort
2021-11-18 14:14 ` [PATCH v2 2/2] sched/fair: Fix task_fits_capacity() capacity type Vincent Donnefort
2021-11-23  8:38   ` Vincent Guittot
2021-12-06 15:20 ` [PATCH v2 1/2] sched/fair: Fix asym_fits_capacity() task_util type Peter Zijlstra
2021-12-07  9:48   ` Vincent Donnefort

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