mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 21:21:09 +00:00
sched/preempt: Optimize preemption operations on __schedule() callers
__schedule() disables preemption and some of its callers (the preempt_schedule*() family) also set PREEMPT_ACTIVE. So we have two preempt_count() modifications that could be performed at once. Lets remove the preemption disablement from __schedule() and pull this responsibility to its callers in order to optimize preempt_count() operations in a single place. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1431441711-29753-5-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
90b62b5129
commit
b30f0e3ffe
2 changed files with 21 additions and 20 deletions
|
@ -137,6 +137,18 @@ extern void preempt_count_sub(int val);
|
|||
#define preempt_count_inc() preempt_count_add(1)
|
||||
#define preempt_count_dec() preempt_count_sub(1)
|
||||
|
||||
#define preempt_active_enter() \
|
||||
do { \
|
||||
preempt_count_add(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
|
||||
barrier(); \
|
||||
} while (0)
|
||||
|
||||
#define preempt_active_exit() \
|
||||
do { \
|
||||
barrier(); \
|
||||
preempt_count_sub(PREEMPT_ACTIVE + PREEMPT_DISABLE_OFFSET); \
|
||||
} while (0)
|
||||
|
||||
#ifdef CONFIG_PREEMPT_COUNT
|
||||
|
||||
#define preempt_disable() \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue