forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sched/preempt, locking: Rework local_bh_{dis,en}able()
Currently local_bh_disable() is out-of-line for no apparent reason. So inline it to save a few cycles on call/return nonsense, the function body is a single add on x86 (a few loads and store extra on load/store archs). Also expose two new local_bh functions: __local_bh_{dis,en}able_ip(unsigned long ip, unsigned int cnt); Which implement the actual local_bh_{dis,en}able() behaviour. The next patch uses the exposed @cnt argument to optimize bh lock functions. With build fixes from Jacob Pan. Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Mike Galbraith <[email protected]> Cc: [email protected] Cc: Arjan van de Ven <[email protected]> Cc: [email protected] Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
- Loading branch information
Peter Zijlstra
authored and
Ingo Molnar
committed
Jan 13, 2014
1 parent
10b033d
commit 0bd3a17
Showing
4 changed files
with
36 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
#ifndef _LINUX_BH_H | ||
#define _LINUX_BH_H | ||
|
||
extern void local_bh_disable(void); | ||
#include <linux/preempt.h> | ||
#include <linux/preempt_mask.h> | ||
|
||
#ifdef CONFIG_TRACE_IRQFLAGS | ||
extern void __local_bh_disable_ip(unsigned long ip, unsigned int cnt); | ||
#else | ||
static __always_inline void __local_bh_disable_ip(unsigned long ip, unsigned int cnt) | ||
{ | ||
preempt_count_add(cnt); | ||
barrier(); | ||
} | ||
#endif | ||
|
||
static inline void local_bh_disable(void) | ||
{ | ||
__local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); | ||
} | ||
|
||
extern void _local_bh_enable(void); | ||
extern void local_bh_enable(void); | ||
extern void local_bh_enable_ip(unsigned long ip); | ||
extern void __local_bh_enable_ip(unsigned long ip, unsigned int cnt); | ||
|
||
static inline void local_bh_enable_ip(unsigned long ip) | ||
{ | ||
__local_bh_enable_ip(ip, SOFTIRQ_DISABLE_OFFSET); | ||
} | ||
|
||
static inline void local_bh_enable(void) | ||
{ | ||
__local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); | ||
} | ||
|
||
#endif /* _LINUX_BH_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters