Commit ee761f629d598579594d7e1eb8c552f3c5f71e4d
1 parent
6546327ad1
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
arch: Consolidate tsk_is_polling()
Move it to a common place. Preparatory patch for implementing set/clear for the idle need_resched poll implementation. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Paul McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Reviewed-by: Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Cc: Magnus Damm <magnus.damm@gmail.com> Link: http://lkml.kernel.org/r/20130321215233.446034505@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Showing 15 changed files with 20 additions and 30 deletions Side-by-side Diff
- arch/alpha/include/asm/thread_info.h
- arch/ia64/include/asm/thread_info.h
- arch/metag/include/asm/thread_info.h
- arch/microblaze/include/asm/thread_info.h
- arch/mn10300/include/asm/thread_info.h
- arch/openrisc/include/asm/thread_info.h
- arch/parisc/include/asm/thread_info.h
- arch/powerpc/include/asm/thread_info.h
- arch/sh/include/asm/thread_info.h
- arch/sparc/include/asm/thread_info_32.h
- arch/sparc/include/asm/thread_info_64.h
- arch/tile/include/asm/thread_info.h
- arch/x86/include/asm/thread_info.h
- include/linux/sched.h
- kernel/sched/core.c
arch/alpha/include/asm/thread_info.h
... | ... | @@ -95,8 +95,6 @@ |
95 | 95 | #define TS_POLLING 0x0010 /* idle task polling need_resched, |
96 | 96 | skip sending interrupt */ |
97 | 97 | |
98 | -#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) | |
99 | - | |
100 | 98 | #ifndef __ASSEMBLY__ |
101 | 99 | #define HAVE_SET_RESTORE_SIGMASK 1 |
102 | 100 | static inline void set_restore_sigmask(void) |
arch/ia64/include/asm/thread_info.h
... | ... | @@ -131,8 +131,6 @@ |
131 | 131 | #define TS_POLLING 1 /* true if in idle loop and not sleeping */ |
132 | 132 | #define TS_RESTORE_SIGMASK 2 /* restore signal mask in do_signal() */ |
133 | 133 | |
134 | -#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) | |
135 | - | |
136 | 134 | #ifndef __ASSEMBLY__ |
137 | 135 | #define HAVE_SET_RESTORE_SIGMASK 1 |
138 | 136 | static inline void set_restore_sigmask(void) |
arch/metag/include/asm/thread_info.h
arch/microblaze/include/asm/thread_info.h
arch/mn10300/include/asm/thread_info.h
... | ... | @@ -165,8 +165,6 @@ |
165 | 165 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ |
166 | 166 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ |
167 | 167 | |
168 | -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | |
169 | - | |
170 | 168 | #endif /* __KERNEL__ */ |
171 | 169 | |
172 | 170 | #endif /* _ASM_THREAD_INFO_H */ |
arch/openrisc/include/asm/thread_info.h
... | ... | @@ -128,8 +128,6 @@ |
128 | 128 | /* For OpenRISC, this is anything in the LSW other than syscall trace */ |
129 | 129 | #define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP)) |
130 | 130 | |
131 | -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | |
132 | - | |
133 | 131 | #endif /* __KERNEL__ */ |
134 | 132 | |
135 | 133 | #endif /* _ASM_THREAD_INFO_H */ |
arch/parisc/include/asm/thread_info.h
arch/powerpc/include/asm/thread_info.h
arch/sh/include/asm/thread_info.h
arch/sparc/include/asm/thread_info_32.h
arch/sparc/include/asm/thread_info_64.h
... | ... | @@ -256,8 +256,6 @@ |
256 | 256 | return true; |
257 | 257 | } |
258 | 258 | |
259 | -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | |
260 | - | |
261 | 259 | #define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0) |
262 | 260 | #define test_thread_64bit_stack(__SP) \ |
263 | 261 | ((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \ |
arch/tile/include/asm/thread_info.h
... | ... | @@ -153,8 +153,6 @@ |
153 | 153 | #define TS_POLLING 0x0004 /* in idle loop but not sleeping */ |
154 | 154 | #define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal */ |
155 | 155 | |
156 | -#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) | |
157 | - | |
158 | 156 | #ifndef __ASSEMBLY__ |
159 | 157 | #define HAVE_SET_RESTORE_SIGMASK 1 |
160 | 158 | static inline void set_restore_sigmask(void) |
arch/x86/include/asm/thread_info.h
... | ... | @@ -241,8 +241,6 @@ |
241 | 241 | skip sending interrupt */ |
242 | 242 | #define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */ |
243 | 243 | |
244 | -#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) | |
245 | - | |
246 | 244 | #ifndef __ASSEMBLY__ |
247 | 245 | #define HAVE_SET_RESTORE_SIGMASK 1 |
248 | 246 | static inline void set_restore_sigmask(void) |
include/linux/sched.h
... | ... | @@ -2622,6 +2622,26 @@ |
2622 | 2622 | } |
2623 | 2623 | |
2624 | 2624 | /* |
2625 | + * Idle thread specific functions to determine the need_resched | |
2626 | + * polling state. We have two versions, one based on TS_POLLING in | |
2627 | + * thread_info.status and one based on TIF_POLLING_NRFLAG in | |
2628 | + * thread_info.flags | |
2629 | + */ | |
2630 | +#ifdef TS_POLLING | |
2631 | +static inline int tsk_is_polling(struct task_struct *p) | |
2632 | +{ | |
2633 | + return task_thread_info(p)->status & TS_POLLING; | |
2634 | +} | |
2635 | +#elif defined(TIF_POLLING_NRFLAG) | |
2636 | +static inline int tsk_is_polling(struct task_struct *p) | |
2637 | +{ | |
2638 | + return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); | |
2639 | +} | |
2640 | +#else | |
2641 | +static inline int tsk_is_polling(struct task_struct *p) { return 0; } | |
2642 | +#endif | |
2643 | + | |
2644 | +/* | |
2625 | 2645 | * Thread group CPU time accounting. |
2626 | 2646 | */ |
2627 | 2647 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); |
kernel/sched/core.c