[patch 03/34] idle: Implement set/clr functions for need_resched poll

From: Thomas Gleixner
Date: Thu Mar 21 2013 - 17:53:13 EST


Implement set/clear functions for the idle need_resched poll
implementation.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
include/linux/sched.h | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

Index: linux-2.6/include/linux/sched.h
===================================================================
--- linux-2.6.orig/include/linux/sched.h
+++ linux-2.6/include/linux/sched.h
@@ -2473,7 +2473,7 @@ static inline unsigned long *end_of_stac
#endif

/*
- * Idle thread specific functions to determine the need_resched
+ * Idle thread specific functions for the 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
@@ -2483,13 +2483,34 @@ static inline int tsk_is_polling(struct
{
return task_thread_info(p)->status & TS_POLLING;
}
+static inline void current_set_polling(void)
+{
+ current_thread_info()->status |= TS_POLLING;
+}
+
+static inline void current_clr_polling(void)
+{
+ current_thread_info()->status &= ~TS_POLLING;
+ smp_mb__after_clear_bit();
+}
#elif defined(TIF_POLLING_NRFLAG)
static inline int tsk_is_polling(struct task_struct *p)
{
test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
}
+static inline void current_set_polling(void)
+{
+ set_thread_flag(TIF_POLLING_NRFLAG);
+}
+
+static inline void current_clr_polling(void)
+{
+ clear_thread_flag(TIF_POLLING_NRFLAG);
+}
#else
static inline int tsk_is_polling(struct task_struct *p) { return 0; }
+static inline void current_set_polling(void) { }
+static inline void current_clr_polling(void) { }
#endif

static inline int object_is_on_stack(void *obj)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/