Commit ee761f629d598579594d7e1eb8c552f3c5f71e4d

Authored by Thomas Gleixner
1 parent 6546327ad1

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
... ... @@ -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
... ... @@ -150,7 +150,5 @@
150 150 #define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
151 151 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
152 152  
153   -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
154   -
155 153 #endif /* _ASM_THREAD_INFO_H */
arch/microblaze/include/asm/thread_info.h
... ... @@ -182,7 +182,6 @@
182 182 ti->status &= ~TS_RESTORE_SIGMASK;
183 183 return true;
184 184 }
185   -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
186 185 #endif
187 186  
188 187 #endif /* __KERNEL__ */
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
... ... @@ -77,8 +77,6 @@
77 77 #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
78 78 _TIF_BLOCKSTEP)
79 79  
80   -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
81   -
82 80 #endif /* __KERNEL__ */
83 81  
84 82 #endif /* _ASM_PARISC_THREAD_INFO_H */
arch/powerpc/include/asm/thread_info.h
... ... @@ -182,8 +182,6 @@
182 182 #define is_32bit_task() (1)
183 183 #endif
184 184  
185   -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
186   -
187 185 #endif /* !__ASSEMBLY__ */
188 186  
189 187 #endif /* __KERNEL__ */
arch/sh/include/asm/thread_info.h
... ... @@ -207,8 +207,6 @@
207 207 return true;
208 208 }
209 209  
210   -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
211   -
212 210 #endif /* !__ASSEMBLY__ */
213 211  
214 212 #endif /* __KERNEL__ */
arch/sparc/include/asm/thread_info_32.h
... ... @@ -132,8 +132,6 @@
132 132 #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
133 133 _TIF_SIGPENDING)
134 134  
135   -#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
136   -
137 135 #endif /* __KERNEL__ */
138 136  
139 137 #endif /* _ASM_THREAD_INFO_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);
... ... @@ -512,11 +512,6 @@
512 512 * the target CPU.
513 513 */
514 514 #ifdef CONFIG_SMP
515   -
516   -#ifndef tsk_is_polling
517   -#define tsk_is_polling(t) 0
518   -#endif
519   -
520 515 void resched_task(struct task_struct *p)
521 516 {
522 517 int cpu;