]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
arch: Consolidate tsk_is_polling()
authorThomas Gleixner <tglx@linutronix.de>
Thu, 21 Mar 2013 21:49:32 +0000 (22:49 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 8 Apr 2013 15:39:22 +0000 (17:39 +0200)
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>
15 files changed:
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

index 1f8c72959fb6c7a1a9891833ae8d9b037cb179d5..52cd2a4a3ff486c8e7acefb35c6e6d24a911f025 100644 (file)
@@ -95,8 +95,6 @@ register struct thread_info *__current_thread_info __asm__("$8");
 #define TS_POLLING             0x0010  /* idle task polling need_resched,
                                           skip sending interrupt */
 
-#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
-
 #ifndef __ASSEMBLY__
 #define HAVE_SET_RESTORE_SIGMASK       1
 static inline void set_restore_sigmask(void)
index 020d655ed082bf9aabbf31a9091468e9045acb0d..cade13dd0299f8754d18d87eded8661b64bf3eb8 100644 (file)
@@ -131,8 +131,6 @@ struct thread_info {
 #define TS_POLLING             1       /* true if in idle loop and not sleeping */
 #define TS_RESTORE_SIGMASK     2       /* restore signal mask in do_signal() */
 
-#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
-
 #ifndef __ASSEMBLY__
 #define HAVE_SET_RESTORE_SIGMASK       1
 static inline void set_restore_sigmask(void)
index 0ecd34d8b5f63ceb1dfd97920c85b3f583ac6ad7..7c4a3300614230ce8d956257412e8e0ab0ade8fb 100644 (file)
@@ -150,6 +150,4 @@ static inline int kstack_end(void *addr)
 #define _TIF_WORK_MASK         (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
                                 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #endif /* _ASM_THREAD_INFO_H */
index 008f30433d22f606f6b6d15f2d644fa5d88c1dd2..de26ea6373ded64af3d7793489be9343a1ee1075 100644 (file)
@@ -182,7 +182,6 @@ static inline bool test_and_clear_restore_sigmask(void)
        ti->status &= ~TS_RESTORE_SIGMASK;
        return true;
 }
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
 #endif
 
 #endif /* __KERNEL__ */
index f90062b0622df11c2f049830f185adefa4a60b22..224b4262486dbca41453861f95461b635bb40bcc 100644 (file)
@@ -165,8 +165,6 @@ void arch_release_thread_info(struct thread_info *ti);
 #define _TIF_WORK_MASK         0x0000FFFE      /* work to do on interrupt/exception return */
 #define _TIF_ALLWORK_MASK      0x0000FFFF      /* work to do on any return to u-space */
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_THREAD_INFO_H */
index 07f3212422adf916f2dfa590f492eb7a4dc517ad..d797acc901e4c2a6a81dd4998a8721c7a085b3bf 100644 (file)
@@ -128,8 +128,6 @@ register struct thread_info *current_thread_info_reg asm("r10");
 /* For OpenRISC, this is anything in the LSW other than syscall trace */
 #define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP))
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_THREAD_INFO_H */
index d1fb79a36f3d32f1632772d6fb366b8416c96a17..6182832e5b6c9c166597f2627ecc9463a38a7d1b 100644 (file)
@@ -77,8 +77,6 @@ struct thread_info {
 #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP |        \
                                 _TIF_BLOCKSTEP)
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_PARISC_THREAD_INFO_H */
index 406b7b9a13412f3736c369f500a5022e4955a928..8ceea14d6fe44a20d0d807e28a4ca63477f18863 100644 (file)
@@ -182,8 +182,6 @@ static inline bool test_thread_local_flags(unsigned int flags)
 #define is_32bit_task()        (1)
 #endif
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
index 7d5ac4e4848518118ad07fce5eb34a763bd6d405..45a93669289da4d7ff53119d9d3ea69158fced7e 100644 (file)
@@ -207,8 +207,6 @@ static inline bool test_and_clear_restore_sigmask(void)
        return true;
 }
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
index 25849ae3e900305e86a138fabebb6b2484a1a07f..dd3807599bb9ac63573191e1086e506699e5d41a 100644 (file)
@@ -132,8 +132,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
 #define _TIF_DO_NOTIFY_RESUME_MASK     (_TIF_NOTIFY_RESUME | \
                                         _TIF_SIGPENDING)
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_THREAD_INFO_H */
index 269bd92313df76e3c2261c464ded3c5c45be4efd..d5e5042510790a1927e5f8b9a234038a599bcab7 100644 (file)
@@ -256,8 +256,6 @@ static inline bool test_and_clear_restore_sigmask(void)
        return true;
 }
 
-#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
-
 #define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0)
 #define test_thread_64bit_stack(__SP) \
        ((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \
index e9c670d7a7fe2e13c1edd65c410f840ba75f5e32..ccc8ef37235c2b6fd9eee0fe7b854c3c714e3468 100644 (file)
@@ -153,8 +153,6 @@ extern void _cpu_idle(void);
 #define TS_POLLING             0x0004  /* in idle loop but not sleeping */
 #define TS_RESTORE_SIGMASK     0x0008  /* restore signal mask in do_signal */
 
-#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
-
 #ifndef __ASSEMBLY__
 #define HAVE_SET_RESTORE_SIGMASK       1
 static inline void set_restore_sigmask(void)
index 2cd056e3ada394aa05c30a9990da58027f535d96..a1df6e84691f962c46fa909af1d93dcd60c7360d 100644 (file)
@@ -241,8 +241,6 @@ static inline struct thread_info *current_thread_info(void)
                                           skip sending interrupt */
 #define TS_RESTORE_SIGMASK     0x0008  /* restore signal mask in do_signal() */
 
-#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
-
 #ifndef __ASSEMBLY__
 #define HAVE_SET_RESTORE_SIGMASK       1
 static inline void set_restore_sigmask(void)
index d35d2b6ddbfb69f098b1660fe280b4d2da8a5ffe..6709a5813f2778d51d4adf3ea73b728384f83e8f 100644 (file)
@@ -2621,6 +2621,26 @@ static inline int spin_needbreak(spinlock_t *lock)
 #endif
 }
 
+/*
+ * Idle thread specific functions to determine the need_resched
+ * polling state. We have two versions, one based on TS_POLLING in
+ * thread_info.status and one based on TIF_POLLING_NRFLAG in
+ * thread_info.flags
+ */
+#ifdef TS_POLLING
+static inline int tsk_is_polling(struct task_struct *p)
+{
+       return task_thread_info(p)->status & TS_POLLING;
+}
+#elif defined(TIF_POLLING_NRFLAG)
+static inline int tsk_is_polling(struct task_struct *p)
+{
+       return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
+}
+#else
+static inline int tsk_is_polling(struct task_struct *p) { return 0; }
+#endif
+
 /*
  * Thread group CPU time accounting.
  */
index 7f12624a393c3100506e5a3eaf588b5f463332ee..243a20c5cf910e66099eb595e64a2bf613215365 100644 (file)
@@ -512,11 +512,6 @@ static inline void init_hrtick(void)
  * the target CPU.
  */
 #ifdef CONFIG_SMP
-
-#ifndef tsk_is_polling
-#define tsk_is_polling(t) 0
-#endif
-
 void resched_task(struct task_struct *p)
 {
        int cpu;