spinlock.h cleanup, resend
Subsystems (2)
PATCH 1/1 spinlock.h cleanup, resend
Linus,
This is a resend of the include/linux/spinlock.h cleanup, with the changes you suggested.
Specifically,
- cleanup #defines: I do not follow the rationale behind the odd line-wrapped defines at the beginning of the file. If we have to use multiple lines, then we might as well do so cleanly and according to normal practice...
- Remove a level of indirection: do not have spin_lock_foo use spin_lock - just explicitly call what is needed.
- we do not need to define the spin_lock functions twice, once for CONFIG_PREEMPT and once for !CONFIG_PREEMPT. Defining them once with the preempt macros will optimize away fine.
- other misc. cleanup, improved comments, reordering, etc.
Patch is against 2.5.30, please apply.
Robert Love
include/linux/preempt.h +11 -7
@@ -1,9 +1,14 @@#ifndef __LINUX_PREEMPT_H#define __LINUX_PREEMPT_H +/* +* include/linux/preempt.h - macros for accessing and manipulating +* preempt_count (used for kernel preemption, interrupt count, etc.) +*/ +#include <linux/config.h> -#define preempt_count () (current_thread_info()->preempt_count) +#define preempt_count () (current_thread_info()->preempt_count)#ifdef CONFIG_PREEMPT
@@ -21,23 +26,22 @@barrier (); \ } while (0) -#define preempt_enable () \ +#define preempt_check_resched () \ do { \ - preempt_enable_no_resched(); \ if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ preempt_schedule(); \ } while (0) -#define preempt_check_resched () \ +#define preempt_enable () \ do { \ - if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ - preempt_schedule(); \ + preempt_enable_no_resched(); \ + preempt_check_resched(); \ } while (0)#else #define preempt_disable () do { } while (0) -#define preempt_enable_no_resched () do {} while(0) +#define preempt_enable_no_resched () do { } while (0)#define preempt_enable () do { } while (0)#define preempt_check_resched () do { } while (0)
include/linux/spinlock.h +191 -83
340 lines not on this page · raw message