From: Ingo Molnar Date: Mon, 9 Jul 2007 16:51:58 +0000 (+0200) Subject: sched: add in_atomic_preempt_off() X-Git-Tag: v2.6.23-rc1~1271 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=4da1ce6d9c7e2a6d9236bf4dcfd33cf506082794;p=linux-2.6-omap-h63xx.git sched: add in_atomic_preempt_off() add in_atomic_preempt_off() - debugging helper that will simplify schedule(). Signed-off-by: Ingo Molnar --- diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 7803014f3a1..8d302298a16 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -78,6 +78,19 @@ # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) #endif +#ifdef CONFIG_PREEMPT +# define PREEMPT_CHECK_OFFSET 1 +#else +# define PREEMPT_CHECK_OFFSET 0 +#endif + +/* + * Check whether we were atomic before we did preempt_disable(): + * (used by the scheduler) + */ +#define in_atomic_preempt_off() \ + ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) + #ifdef CONFIG_PREEMPT # define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)