Skip to content

Commit 11d4afd

Browse files
vingu-linaroingomolnar
authored andcommitted
sched/pelt: Fix warning and clean up IRQ PELT config
Create a config for enabling irq load tracking in the scheduler. irq load tracking is useful only when irq or paravirtual time is accounted but it's only possible with SMP for now. Also use __maybe_unused to remove the compilation warning in update_rq_clock_task() that has been introduced by: 2e62c47 ("sched/fair: Remove #ifdefs from scale_rt_capacity()") Suggested-by: Ingo Molnar <mingo@redhat.com> Reported-by: Dou Liyang <douly.fnst@cn.fujitsu.com> Reported-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: bp@alien8.de Cc: dou_liyang@163.com Fixes: 2e62c47 ("sched/fair: Remove #ifdefs from scale_rt_capacity()") Link: http://lkml.kernel.org/r/1537867062-27285-1-git-send-email-vincent.guittot@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent b429f71 commit 11d4afd

6 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎init/Kconfig‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,11 @@ config IRQ_TIME_ACCOUNTING
415415

416416
If in doubt, say N here.
417417

418+
config HAVE_SCHED_AVG_IRQ
419+
def_bool y
420+
depends on IRQ_TIME_ACCOUNTING || PARAVIRT_TIME_ACCOUNTING
421+
depends on SMP
422+
418423
config BSD_PROCESS_ACCT
419424
bool "BSD Process Accounting"
420425
depends on MULTIUSER

‎kernel/sched/core.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,8 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
135135
* In theory, the compile should just see 0 here, and optimize out the call
136136
* to sched_rt_avg_update. But I don't trust it...
137137
*/
138-
#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
139-
s64 steal = 0, irq_delta = 0;
140-
#endif
138+
s64 __maybe_unused steal = 0, irq_delta = 0;
139+
141140
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
142141
irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
143142

@@ -177,7 +176,7 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
177176

178177
rq->clock_task += delta;
179178

180-
#ifdef HAVE_SCHED_AVG_IRQ
179+
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
181180
if ((irq_delta + steal) && sched_feat(NONTASK_CAPACITY))
182181
update_irq_load_avg(rq, irq_delta + steal);
183182
#endif

‎kernel/sched/fair.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7317,7 +7317,7 @@ static inline bool others_have_blocked(struct rq *rq)
73177317
if (READ_ONCE(rq->avg_dl.util_avg))
73187318
return true;
73197319

7320-
#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
7320+
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
73217321
if (READ_ONCE(rq->avg_irq.util_avg))
73227322
return true;
73237323
#endif

‎kernel/sched/pelt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running)
358358
return 0;
359359
}
360360

361-
#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
361+
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
362362
/*
363363
* irq:
364364
*

‎kernel/sched/pelt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int __update_load_avg_cfs_rq(u64 now, int cpu, struct cfs_rq *cfs_rq);
66
int update_rt_rq_load_avg(u64 now, struct rq *rq, int running);
77
int update_dl_rq_load_avg(u64 now, struct rq *rq, int running);
88

9-
#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
9+
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
1010
int update_irq_load_avg(struct rq *rq, u64 running);
1111
#else
1212
static inline int

‎kernel/sched/sched.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,7 @@ struct rq {
862862

863863
struct sched_avg avg_rt;
864864
struct sched_avg avg_dl;
865-
#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
866-
#define HAVE_SCHED_AVG_IRQ
865+
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
867866
struct sched_avg avg_irq;
868867
#endif
869868
u64 idle_stamp;
@@ -2223,7 +2222,7 @@ static inline unsigned long cpu_util_rt(struct rq *rq)
22232222
}
22242223
#endif
22252224

2226-
#ifdef HAVE_SCHED_AVG_IRQ
2225+
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
22272226
static inline unsigned long cpu_util_irq(struct rq *rq)
22282227
{
22292228
return rq->avg_irq.util_avg;

0 commit comments

Comments
 (0)