linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: fix -Wunused-but-set-variable warnings
@ 2019-09-18 19:01 Qian Cai
  2019-09-18 20:11 ` Dave Chiluk
  0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2019-09-18 19:01 UTC (permalink / raw)
  To: mingo
  Cc: peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
	bsegall, mgorman, chiluk+linux, pauld, linux-kernel, Qian Cai

The commit de53fd7aedb1 ("sched/fair: Fix low cpu usage with high
throttling by removing expiration of cpu-local slices") introduced a few
compilation warnings:

  kernel/sched/fair.c: In function '__refill_cfs_bandwidth_runtime':
  kernel/sched/fair.c:4365:6: warning: variable 'now' set but not used
    [-Wunused-but-set-variable]
  kernel/sched/fair.c: In function 'start_cfs_bandwidth':
  kernel/sched/fair.c:4992:6: warning: variable 'overrun' set but not
    used [-Wunused-but-set-variable]

Also, __refill_cfs_bandwidth_runtime() does no longer update the
expiration time, so fix the comments accordingly.

Fixes: de53fd7aedb1 ("sched/fair: Fix low cpu usage with high throttling by removing expiration of cpu-local slices")
Reviewed-by: Ben Segall <bsegall@google.com>
Reviewed-by: Dave Chiluk <chiluk+linux@indeed.com>
Signed-off-by: Qian Cai <cai@lca.pw>
---

Resend it since the offensive commit is now in the mainline.

 kernel/sched/fair.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d4bbf68c3161..b4fb016e3557 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4354,21 +4354,16 @@ static inline u64 sched_cfs_bandwidth_slice(void)
 }
 
 /*
- * Replenish runtime according to assigned quota and update expiration time.
- * We use sched_clock_cpu directly instead of rq->clock to avoid adding
- * additional synchronization around rq->lock.
+ * Replenish runtime according to assigned quota. We use sched_clock_cpu
+ * directly instead of rq->clock to avoid adding additional synchronization
+ * around rq->lock.
  *
  * requires cfs_b->lock
  */
 void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b)
 {
-	u64 now;
-
-	if (cfs_b->quota == RUNTIME_INF)
-		return;
-
-	now = sched_clock_cpu(smp_processor_id());
-	cfs_b->runtime = cfs_b->quota;
+	if (cfs_b->quota != RUNTIME_INF)
+		cfs_b->runtime = cfs_b->quota;
 }
 
 static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
@@ -4994,15 +4989,13 @@ static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq)
 
 void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
 {
-	u64 overrun;
-
 	lockdep_assert_held(&cfs_b->lock);
 
 	if (cfs_b->period_active)
 		return;
 
 	cfs_b->period_active = 1;
-	overrun = hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
+	hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
 	hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED);
 }
 
-- 
1.8.3.1


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

* Re: [PATCH] sched/fair: fix -Wunused-but-set-variable warnings
  2019-09-18 19:01 [PATCH] sched/fair: fix -Wunused-but-set-variable warnings Qian Cai
@ 2019-09-18 20:11 ` Dave Chiluk
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Chiluk @ 2019-09-18 20:11 UTC (permalink / raw)
  To: Qian Cai
  Cc: Ingo Molnar, Peter Zijlstra, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, Ben Segall, mgorman, Phil Auld,
	Linux Kernel Mailing List

de53fd7aedb1 has just been merged into Linus' mainline tree for
eventual inclusion in 5.4.  This should be pushed into there, and not
wait till 5.5.

Both I and Ben Segall have already +1'd this in previous threads.

Sorry for introducing the warnings.

Dave.

On Wed, Sep 18, 2019 at 2:02 PM Qian Cai <cai@lca.pw> wrote:
>
> The commit de53fd7aedb1 ("sched/fair: Fix low cpu usage with high
> throttling by removing expiration of cpu-local slices") introduced a few
> compilation warnings:
>
>   kernel/sched/fair.c: In function '__refill_cfs_bandwidth_runtime':
>   kernel/sched/fair.c:4365:6: warning: variable 'now' set but not used
>     [-Wunused-but-set-variable]
>   kernel/sched/fair.c: In function 'start_cfs_bandwidth':
>   kernel/sched/fair.c:4992:6: warning: variable 'overrun' set but not
>     used [-Wunused-but-set-variable]
>
> Also, __refill_cfs_bandwidth_runtime() does no longer update the
> expiration time, so fix the comments accordingly.
>
> Fixes: de53fd7aedb1 ("sched/fair: Fix low cpu usage with high throttling by removing expiration of cpu-local slices")
> Reviewed-by: Ben Segall <bsegall@google.com>
> Reviewed-by: Dave Chiluk <chiluk+linux@indeed.com>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>
> Resend it since the offensive commit is now in the mainline.
>
>  kernel/sched/fair.c | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d4bbf68c3161..b4fb016e3557 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4354,21 +4354,16 @@ static inline u64 sched_cfs_bandwidth_slice(void)
>  }
>
>  /*
> - * Replenish runtime according to assigned quota and update expiration time.
> - * We use sched_clock_cpu directly instead of rq->clock to avoid adding
> - * additional synchronization around rq->lock.
> + * Replenish runtime according to assigned quota. We use sched_clock_cpu
> + * directly instead of rq->clock to avoid adding additional synchronization
> + * around rq->lock.
>   *
>   * requires cfs_b->lock
>   */
>  void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b)
>  {
> -       u64 now;
> -
> -       if (cfs_b->quota == RUNTIME_INF)
> -               return;
> -
> -       now = sched_clock_cpu(smp_processor_id());
> -       cfs_b->runtime = cfs_b->quota;
> +       if (cfs_b->quota != RUNTIME_INF)
> +               cfs_b->runtime = cfs_b->quota;
>  }
>
>  static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
> @@ -4994,15 +4989,13 @@ static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq)
>
>  void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
>  {
> -       u64 overrun;
> -
>         lockdep_assert_held(&cfs_b->lock);
>
>         if (cfs_b->period_active)
>                 return;
>
>         cfs_b->period_active = 1;
> -       overrun = hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
> +       hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
>         hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED);
>  }
>
> --
> 1.8.3.1
>

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

end of thread, other threads:[~2019-09-18 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 19:01 [PATCH] sched/fair: fix -Wunused-but-set-variable warnings Qian Cai
2019-09-18 20:11 ` Dave Chiluk

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