[PATCH v2] preempt: fix kernel build with !CONFIG_BKL

From: Arnd Bergmann
Date: Thu Oct 28 2010 - 10:12:48 EST


The preempt count logic tries to take the BKL into account, which breaks
when CONFIG_BKL is not set.

Use the same preempt_count offset that we use without CONFIG_PREEMPT
when CONFIG_BKL is disabled.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Reported-by: Kirill Shutemov <kirill@xxxxxxxxxxxxx>
---
> On Thursday 28 October 2010, Kirill A. Shutemov wrote:
> On Thu, Oct 28, 2010 at 01:20:44PM +0200, Arnd Bergmann wrote:
> > The preempt count logic tries to take the BKL into account, which breaks
> > when CONFIG_BKL is not set.
> >
> > Use the same preempt_count offset that we use without CONFIG_PREEMPT
> > when CONFIG_BKL is disabled.
> >
> > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> > Reported-by: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx>
>
> Remove quotes, please.

That would make it an invalid email address because of the dot. I left out
the middle initial now, if that's better.

> I've got a lot of __schedule_bug. Log attached.

Ok. I really don't understand the preempt code all that well, let's
hope that this one is right.

Thanks for your patience and for your testing!

Arnd

diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8a389b6..41cb31f 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -96,11 +96,15 @@
*/
#define in_nmi() (preempt_count() & NMI_MASK)

-#if defined(CONFIG_PREEMPT)
+#if defined(CONFIG_PREEMPT) && defined(CONFIG_BKL)
# define PREEMPT_INATOMIC_BASE kernel_locked()
-# define PREEMPT_CHECK_OFFSET 1
#else
# define PREEMPT_INATOMIC_BASE 0
+#endif
+
+#if defined(CONFIG_PREEMPT)
+# define PREEMPT_CHECK_OFFSET 1
+#else
# define PREEMPT_CHECK_OFFSET 0
#endif

--
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/