Messages in this thread Patch in this message | | | From | Linus Torvalds <> | Date | Wed, 17 Nov 2010 14:23:23 -0800 | Subject | Re: BKL: remove extraneous #include <smp_lock.h> |
| |
On Wed, Nov 17, 2010 at 2:05 PM, Randy Dunlap <randy.dunlap@oracle.com> wrote: > > smp_lock.h was removed from hardirq.h. smp_lock.h provided the function prototype > for kernel_locked(). Should source files now #include <linux/smp_lock.h> ? > even when not being built for SMP?
Hmm. I think that part was a mistake, but I suspect the simplest fix for it is to simply get rid of "kernel_locked()". It has no other users than the hardirq.h one, so let's just move it there.
Something like the attached?
NOTE! The reason I _only_ take the CONFIG_LOCK_KERNEL version from smp_lock.h is because:
- LOCK_KERNEL is defined by init/Kconfig as "(SMP || PREEMPT) && BKL"
- inside hardirq.h we only use "kernel_locked()" inside "PREEMPT && BKL"
- so "PREEMPT && BKL" implies "LOCK_KERNEL"
- so the !LOCK_KERNEL kernel_locked() case is irrelevant.
unless I did a thinko somewhere.
Does this work in all configurations? TOTALLY UNTESTED! Caveat emptor.
Linus include/linux/hardirq.h | 2 +- include/linux/smp_lock.h | 3 --- 2 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 8f3f467..bea1612 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -96,7 +96,7 @@ #define in_nmi() (preempt_count() & NMI_MASK) #if defined(CONFIG_PREEMPT) && defined(CONFIG_BKL) -# define PREEMPT_INATOMIC_BASE kernel_locked() +# define PREEMPT_INATOMIC_BASE (current->lock_depth >= 0) #else # define PREEMPT_INATOMIC_BASE 0 #endif diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h index 291f721..3a19882 100644 --- a/include/linux/smp_lock.h +++ b/include/linux/smp_lock.h @@ -4,8 +4,6 @@ #ifdef CONFIG_LOCK_KERNEL #include <linux/sched.h> -#define kernel_locked() (current->lock_depth >= 0) - extern int __lockfunc __reacquire_kernel_lock(void); extern void __lockfunc __release_kernel_lock(void); @@ -58,7 +56,6 @@ static inline void cycle_kernel_lock(void) #define lock_kernel() #define unlock_kernel() #define cycle_kernel_lock() do { } while(0) -#define kernel_locked() 1 #endif /* CONFIG_BKL */ #define release_kernel_lock(task) do { } while(0) | |