mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
sched/debug: Add SCHED_WARN_ON()
Provide SCHED_WARN_ON as wrapper for WARN_ON_ONCE() to avoid CONFIG_SCHED_DEBUG wrappery. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
1 parent
49bd21efe7
commit
9148a3a10e
2 files changed
+10
-6
No files matched your search
+3
-5
@@ -262,9 +262,7 @@ static inline struct rq *rq_of(struct cfs_rq *cfs_rq)
|
||||
|
||||
static inline struct task_struct *task_of(struct sched_entity *se)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_DEBUG
|
||||
WARN_ON_ONCE(!entity_is_task(se));
|
||||
#endif
|
||||
SCHED_WARN_ON(!entity_is_task(se));
|
||||
return container_of(se, struct task_struct, se);
|
||||
}
|
||||
|
||||
@@ -2369,7 +2367,7 @@ void task_numa_work(struct callback_head *work)
|
||||
unsigned long nr_pte_updates = 0;
|
||||
long pages, virtpages;
|
||||
|
||||
WARN_ON_ONCE(p != container_of(work, struct task_struct, numa_work));
|
||||
SCHED_WARN_ON(p != container_of(work, struct task_struct, numa_work));
|
||||
|
||||
work->next = work; /* protect against double add */
|
||||
/*
|
||||
@@ -4474,7 +4472,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
|
||||
struct sched_entity *se = &p->se;
|
||||
struct cfs_rq *cfs_rq = cfs_rq_of(se);
|
||||
|
||||
WARN_ON(task_rq(p) != rq);
|
||||
SCHED_WARN_ON(task_rq(p) != rq);
|
||||
|
||||
if (rq->cfs.h_nr_running > 1) {
|
||||
u64 slice = sched_slice(cfs_rq, se);
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
#include "cpudeadline.h"
|
||||
#include "cpuacct.h"
|
||||
|
||||
#ifdef CONFIG_SCHED_DEBUG
|
||||
#define SCHED_WARN_ON(x) WARN_ONCE(x, #x)
|
||||
#else
|
||||
#define SCHED_WARN_ON(x) ((void)(x))
|
||||
#endif
|
||||
|
||||
struct rq;
|
||||
struct cpuidle_state;
|
||||
|
||||
@@ -1309,7 +1315,7 @@ static inline void idle_set_state(struct rq *rq,
|
||||
|
||||
static inline struct cpuidle_state *idle_get_state(struct rq *rq)
|
||||
{
|
||||
WARN_ON(!rcu_read_lock_held());
|
||||
SCHED_WARN_ON(!rcu_read_lock_held());
|
||||
return rq->idle_state;
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user