mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 13:11:14 +00:00
sched: Introduce preempt_count accessor functions
Replace the single preempt_count() 'function' that's an lvalue with two proper functions: preempt_count() - returns the preempt_count value as rvalue preempt_count_set() - Allows setting the preempt-count value Also provide preempt_count_ptr() as a convenience wrapper to implement all modifying operations. Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/n/tip-orxrbycjozopqfhb4dxdkdvb@git.kernel.org [ Fixed build failure. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
ea81174789
commit
4a2b4b2227
7 changed files with 30 additions and 18 deletions
|
@ -10,19 +10,32 @@
|
|||
#include <linux/linkage.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
static __always_inline int preempt_count(void)
|
||||
{
|
||||
return current_thread_info()->preempt_count;
|
||||
}
|
||||
|
||||
static __always_inline int *preempt_count_ptr(void)
|
||||
{
|
||||
return ¤t_thread_info()->preempt_count;
|
||||
}
|
||||
|
||||
static __always_inline void preempt_count_set(int pc)
|
||||
{
|
||||
*preempt_count_ptr() = pc;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
|
||||
extern void add_preempt_count(int val);
|
||||
extern void sub_preempt_count(int val);
|
||||
#else
|
||||
# define add_preempt_count(val) do { preempt_count() += (val); } while (0)
|
||||
# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
|
||||
# define add_preempt_count(val) do { *preempt_count_ptr() += (val); } while (0)
|
||||
# define sub_preempt_count(val) do { *preempt_count_ptr() -= (val); } while (0)
|
||||
#endif
|
||||
|
||||
#define inc_preempt_count() add_preempt_count(1)
|
||||
#define dec_preempt_count() sub_preempt_count(1)
|
||||
|
||||
#define preempt_count() (current_thread_info()->preempt_count)
|
||||
|
||||
#ifdef CONFIG_PREEMPT
|
||||
|
||||
asmlinkage void preempt_schedule(void);
|
||||
|
@ -81,9 +94,9 @@ do { \
|
|||
|
||||
/* For debugging and tracer internals only! */
|
||||
#define add_preempt_count_notrace(val) \
|
||||
do { preempt_count() += (val); } while (0)
|
||||
do { *preempt_count_ptr() += (val); } while (0)
|
||||
#define sub_preempt_count_notrace(val) \
|
||||
do { preempt_count() -= (val); } while (0)
|
||||
do { *preempt_count_ptr() -= (val); } while (0)
|
||||
#define inc_preempt_count_notrace() add_preempt_count_notrace(1)
|
||||
#define dec_preempt_count_notrace() sub_preempt_count_notrace(1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue