Skip to content

Commit c1a280b

Browse files
KAGA-KOKOingomolnar
authored andcommitted
sched/preempt: Use CONFIG_PREEMPTION where appropriate
CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT. Both PREEMPT and PREEMPT_RT require the same functionality which today depends on CONFIG_PREEMPT. Switch the preemption code, scheduler and init task over to use CONFIG_PREEMPTION. That's the first step towards RT in that area. The more complex changes are coming separately. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Paul E. McKenney <paulmck@linux.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/20190726212124.117528401@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 2a11c76 commit c1a280b

8 files changed

Lines changed: 20 additions & 20 deletions

File tree

‎include/asm-generic/preempt.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ static __always_inline bool should_resched(int preempt_offset)
7878
tif_need_resched());
7979
}
8080

81-
#ifdef CONFIG_PREEMPT
81+
#ifdef CONFIG_PREEMPTION
8282
extern asmlinkage void preempt_schedule(void);
8383
#define __preempt_schedule() preempt_schedule()
8484
extern asmlinkage void preempt_schedule_notrace(void);
8585
#define __preempt_schedule_notrace() preempt_schedule_notrace()
86-
#endif /* CONFIG_PREEMPT */
86+
#endif /* CONFIG_PREEMPTION */
8787

8888
#endif /* __ASM_PREEMPT_H */

‎include/linux/preempt.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ do { \
182182

183183
#define preemptible() (preempt_count() == 0 && !irqs_disabled())
184184

185-
#ifdef CONFIG_PREEMPT
185+
#ifdef CONFIG_PREEMPTION
186186
#define preempt_enable() \
187187
do { \
188188
barrier(); \
@@ -203,7 +203,7 @@ do { \
203203
__preempt_schedule(); \
204204
} while (0)
205205

206-
#else /* !CONFIG_PREEMPT */
206+
#else /* !CONFIG_PREEMPTION */
207207
#define preempt_enable() \
208208
do { \
209209
barrier(); \
@@ -217,7 +217,7 @@ do { \
217217
} while (0)
218218

219219
#define preempt_check_resched() do { } while (0)
220-
#endif /* CONFIG_PREEMPT */
220+
#endif /* CONFIG_PREEMPTION */
221221

222222
#define preempt_disable_notrace() \
223223
do { \

‎include/linux/sched.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ static inline int test_tsk_need_resched(struct task_struct *tsk)
17671767
* value indicates whether a reschedule was done in fact.
17681768
* cond_resched_lock() will drop the spinlock before scheduling,
17691769
*/
1770-
#ifndef CONFIG_PREEMPT
1770+
#ifndef CONFIG_PREEMPTION
17711771
extern int _cond_resched(void);
17721772
#else
17731773
static inline int _cond_resched(void) { return 0; }
@@ -1796,12 +1796,12 @@ static inline void cond_resched_rcu(void)
17961796

17971797
/*
17981798
* Does a critical section need to be broken due to another
1799-
* task waiting?: (technically does not depend on CONFIG_PREEMPT,
1799+
* task waiting?: (technically does not depend on CONFIG_PREEMPTION,
18001800
* but a general need for low latency)
18011801
*/
18021802
static inline int spin_needbreak(spinlock_t *lock)
18031803
{
1804-
#ifdef CONFIG_PREEMPT
1804+
#ifdef CONFIG_PREEMPTION
18051805
return spin_is_contended(lock);
18061806
#else
18071807
return 0;

‎init/init_task.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ struct task_struct init_task
174174
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
175175
.ret_stack = NULL,
176176
#endif
177-
#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPT)
177+
#if defined(CONFIG_TRACING) && defined(CONFIG_PREEMPTION)
178178
.trace_recursion = 0,
179179
#endif
180180
#ifdef CONFIG_LIVEPATCH

‎init/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ noinline void __ref rest_init(void)
433433

434434
/*
435435
* Enable might_sleep() and smp_processor_id() checks.
436-
* They cannot be enabled earlier because with CONFIG_PREEMPT=y
436+
* They cannot be enabled earlier because with CONFIG_PREEMPTION=y
437437
* kernel_thread() would trigger might_sleep() splats. With
438438
* CONFIG_PREEMPT_VOLUNTARY=y the init task might have scheduled
439439
* already, but it's stuck on the kthreadd_done completion.

‎kernel/sched/core.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3581,7 +3581,7 @@ static inline void sched_tick_start(int cpu) { }
35813581
static inline void sched_tick_stop(int cpu) { }
35823582
#endif
35833583

3584-
#if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \
3584+
#if defined(CONFIG_PREEMPTION) && (defined(CONFIG_DEBUG_PREEMPT) || \
35853585
defined(CONFIG_TRACE_PREEMPT_TOGGLE))
35863586
/*
35873587
* If the value passed in is equal to the current preempt count
@@ -3782,7 +3782,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
37823782
* task, then the wakeup sets TIF_NEED_RESCHED and schedule() gets
37833783
* called on the nearest possible occasion:
37843784
*
3785-
* - If the kernel is preemptible (CONFIG_PREEMPT=y):
3785+
* - If the kernel is preemptible (CONFIG_PREEMPTION=y):
37863786
*
37873787
* - in syscall or exception context, at the next outmost
37883788
* preempt_enable(). (this might be as soon as the wake_up()'s
@@ -3791,7 +3791,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
37913791
* - in IRQ context, return from interrupt-handler to
37923792
* preemptible context
37933793
*
3794-
* - If the kernel is not preemptible (CONFIG_PREEMPT is not set)
3794+
* - If the kernel is not preemptible (CONFIG_PREEMPTION is not set)
37953795
* then at the next:
37963796
*
37973797
* - cond_resched() call
@@ -4033,7 +4033,7 @@ static void __sched notrace preempt_schedule_common(void)
40334033
} while (need_resched());
40344034
}
40354035

4036-
#ifdef CONFIG_PREEMPT
4036+
#ifdef CONFIG_PREEMPTION
40374037
/*
40384038
* this is the entry point to schedule() from in-kernel preemption
40394039
* off of preempt_enable. Kernel preemptions off return from interrupt
@@ -4105,7 +4105,7 @@ asmlinkage __visible void __sched notrace preempt_schedule_notrace(void)
41054105
}
41064106
EXPORT_SYMBOL_GPL(preempt_schedule_notrace);
41074107

4108-
#endif /* CONFIG_PREEMPT */
4108+
#endif /* CONFIG_PREEMPTION */
41094109

41104110
/*
41114111
* this is the entry point to schedule() from kernel preemption
@@ -5416,7 +5416,7 @@ SYSCALL_DEFINE0(sched_yield)
54165416
return 0;
54175417
}
54185418

5419-
#ifndef CONFIG_PREEMPT
5419+
#ifndef CONFIG_PREEMPTION
54205420
int __sched _cond_resched(void)
54215421
{
54225422
if (should_resched(0)) {
@@ -5433,7 +5433,7 @@ EXPORT_SYMBOL(_cond_resched);
54335433
* __cond_resched_lock() - if a reschedule is pending, drop the given lock,
54345434
* call schedule, and on return reacquire the lock.
54355435
*
5436-
* This works OK both with and without CONFIG_PREEMPT. We do strange low-level
5436+
* This works OK both with and without CONFIG_PREEMPTION. We do strange low-level
54375437
* operations here to prevent schedule() from being called twice (once via
54385438
* spin_unlock(), once by hand).
54395439
*/

‎kernel/sched/fair.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7430,7 +7430,7 @@ static int detach_tasks(struct lb_env *env)
74307430
detached++;
74317431
env->imbalance -= load;
74327432

7433-
#ifdef CONFIG_PREEMPT
7433+
#ifdef CONFIG_PREEMPTION
74347434
/*
74357435
* NEWIDLE balancing is a source of latency, so preemptible
74367436
* kernels will stop after the first task is detached to minimize

‎kernel/sched/sched.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,7 @@ unsigned long arch_scale_freq_capacity(int cpu)
19431943
#endif
19441944

19451945
#ifdef CONFIG_SMP
1946-
#ifdef CONFIG_PREEMPT
1946+
#ifdef CONFIG_PREEMPTION
19471947

19481948
static inline void double_rq_lock(struct rq *rq1, struct rq *rq2);
19491949

@@ -1995,7 +1995,7 @@ static inline int _double_lock_balance(struct rq *this_rq, struct rq *busiest)
19951995
return ret;
19961996
}
19971997

1998-
#endif /* CONFIG_PREEMPT */
1998+
#endif /* CONFIG_PREEMPTION */
19991999

20002000
/*
20012001
* double_lock_balance - lock the busiest runqueue, this_rq is locked already.

0 commit comments

Comments
 (0)