xen/sched: Drop the *_UNIT_CHECK() macros
PATCH 1/1 xen/sched: Drop the *_UNIT_CHECK() macros
All these do is conditionalise calling the related check function. Compile the function generally, and use an early exit to DCE it in release builds.
No functional change.
Signed-off-by Andrew Cooper <[email protected]>
---
CC: Dario Faggioli <[email protected]>
CC: Juergen Gross <[email protected]>
CC: George Dunlap <[email protected]>
--- xen/common/sched/credit.c | 14 ++++++-------- xen/common/sched/credit2.c | 14 ++++++-------- xen/common/sched/null.c | 12 +++++------- 3 files changed, 17 insertions(+), 23 deletions(-)
xen/common/sched/credit.c +6 -8
@@ -660,13 +660,15 @@ csched_switch_sched(struct scheduler *new_ops, unsigned int cpu,return &sr->_lock; } -#ifndef NDEBUG static inline void -__csched_unit_check (const struct sched_unit *unit) +csched_unit_check (const struct sched_unit *unit) {struct csched_unit *const svc =CSCHED_UNIT (unit);struct csched_dom *const sdom = svc->sdom; +if ( !IS_ENABLED (CONFIG_DEBUG ) ) +return ; +BUG_ON ( svc->unit != unit );BUG_ON ( sdom !=CSCHED_DOM (unit->domain) );if ( sdom )
@@ -681,10 +683,6 @@ __csched_unit_check(const struct sched_unit *unit)SCHED_STAT_CRANK (unit_check); } -#define CSCHED_UNIT_CHECK (unit) (__csched_unit_check(unit)) -#else -#define CSCHED_UNIT_CHECK (unit) -#endif /* * Delay, in microseconds, between migrations of a UNIT between PCPUs.
@@ -1863,7 +1861,7 @@ static void cf_check csched_schedule(bool migrated = false;SCHED_STAT_CRANK (schedule); -CSCHED_UNIT_CHECK (unit); +csched_unit_check (unit);if (unlikely (tb_init_done) ) {
@@ -2034,7 +2032,7 @@ static void cf_check csched_schedule(set_timer (&spc->ticker, now +MICROSECS (prv->tick_period_us) - now %MICROSECS (prv->tick_period_us) ); -CSCHED_UNIT_CHECK (unit->next_task); +csched_unit_check (unit->next_task); } static void
xen/common/sched/credit2.c +6 -8
@@ -2153,13 +2153,15 @@ static void cf_check replenish_domain_budget(void *data)set_timer (&sdom->repl_timer, sdom->next_repl); } -#ifndef NDEBUG static inline void csched2_unit_check (const struct sched_unit *unit) {struct csched2_unit *const svc =csched2_unit (unit);struct csched2_dom *const sdom = svc->sdom; +if ( !IS_ENABLED (CONFIG_DEBUG ) ) +return ; +BUG_ON ( svc->unit != unit );BUG_ON ( sdom !=csched2_dom (unit->domain) );if ( sdom )
@@ -2173,10 +2175,6 @@ csched2_unit_check(const struct sched_unit *unit) }SCHED_STAT_CRANK (unit_check); } -#define CSCHED2_UNIT_CHECK (unit) (csched2_unit_check(unit)) -#else -#define CSCHED2_UNIT_CHECK (unit) -#endif static void *cf_check csched2_alloc_udata(const struct scheduler *ops, struct sched_unit *unit,
@@ -3244,7 +3242,7 @@ csched2_unit_insert(const struct scheduler *ops, struct sched_unit *unit)SCHED_STAT_CRANK (unit_insert); -CSCHED2_UNIT_CHECK (unit); +csched2_unit_check (unit); }static void cf_check
@@ -3595,7 +3593,7 @@ static void cf_check csched2_schedule(bool migrated = false;SCHED_STAT_CRANK (schedule); -CSCHED2_UNIT_CHECK (currunit); +csched2_unit_check (currunit);BUG_ON (!cpumask_test_cpu (sched_cpu, &csched2_priv (ops)->initialized));
@@ -3777,7 +3775,7 @@ static void cf_check csched2_schedule( currunit->next_task = snext->unit; snext->unit->migrated = migrated; -CSCHED2_UNIT_CHECK (currunit->next_task); +csched2_unit_check (currunit->next_task); } static void
xen/common/sched/null.c +5 -7
@@ -785,12 +785,14 @@ static void cf_check null_unit_migrate(sched_set_res (unit,get_sched_res (new_cpu)); } -#ifndef NDEBUG static inline void null_unit_check (struct sched_unit *unit) {struct null_unit *const nvc =null_unit (unit);struct null_dom *const ndom = unit->domain->sched_priv; +if ( !IS_ENABLED (CONFIG_DEBUG ) ) +return ; +BUG_ON (nvc->unit != unit);if ( ndom )
@@ -800,10 +802,6 @@ static inline void null_unit_check(struct sched_unit *unit)SCHED_STAT_CRANK (unit_check); } -#define NULL_UNIT_CHECK (unit) (null_unit_check(unit)) -#else -#define NULL_UNIT_CHECK (unit) -#endif /*
@@ -823,7 +821,7 @@ static void cf_check null_schedule(struct null_unit *wvc;SCHED_STAT_CRANK (schedule); -NULL_UNIT_CHECK (current->sched_unit); +null_unit_check (current->sched_unit);if (unlikely (tb_init_done) ) {
@@ -940,7 +938,7 @@ static void cf_check null_schedule( !unit_runnable_state(prev->next_task)) ) prev->next_task =sched_idle_unit (sched_cpu); -NULL_UNIT_CHECK (prev->next_task); +null_unit_check (prev->next_task); prev->next_task->migrated = false; }
Signature · 1 line
2.39.5
Quoted 6 lines · Andrew Cooper
All these do is conditionalise calling the related check function. Compile the function generally, and use an early exit to DCE it in release builds.
No functional change.
Signed-off-by Andrew Cooper <[email protected]>
Reviewed-by Juergen Gross <[email protected]>
Juergen