|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] 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 <andrew.cooper3@xxxxxxxxxx>
---
CC: Dario Faggioli <dfaggioli@xxxxxxxx>
CC: Juergen Gross <jgross@xxxxxxxx>
CC: George Dunlap <gwd@xxxxxxxxxxxxxx>
---
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(-)
diff --git a/xen/common/sched/credit.c b/xen/common/sched/credit.c
index f1a9b4aed1ae..8435c2441024 100644
--- a/xen/common/sched/credit.c
+++ b/xen/common/sched/credit.c
@@ -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
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index c32e753bb4f0..042168e531c6 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -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
diff --git a/xen/common/sched/null.c b/xen/common/sched/null.c
index b3c6651fb1f5..1099041c130f 100644
--- a/xen/common/sched/null.c
+++ b/xen/common/sched/null.c
@@ -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;
}
--
2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |