linux-2.6.33/__lock_kernel()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#ecfe8edf]
#backlinks
*説明 [#fb83445f]
-パス: [[linux-2.6.33/lib/kernel_lock.c]]
-FIXME: これは何?
--BKL(Big Kernel Lock)の 1回目のロック
**引数 [#ic341602]
-なし
**返り値 [#h4d769f8]
-なし
**参考 [#c58a66d4]
*実装 [#hf37218a]
**プリエンプション有効の場合 [#i4a1f6cf]
/*
* These are the BKL spinlocks - we try to be polite abo...
* If SMP is not on (ie UP preemption), this all goes aw...
* do_raw_spin_trylock() will always succeed.
*/
#ifdef CONFIG_PREEMPT
-
--[[linux-2.6.33/CONFIG_PREEMPT]]
static inline void __lock_kernel(void)
{
preempt_disable();
-
--[[linux-2.6.33/preempt_disable()]]
if (unlikely(!do_raw_spin_trylock(&kernel_flag))) {
-
--[[linux-2.6.33/unlikely()]]
-
--[[linux-2.6.33/do_raw_spin_trylock()]]
-
--[[linux-2.6.33/kernel_flag(global)]]
/*
* If preemption was disabled even before this
* was called, there's nothing we can be polite
* about - just spin.
*/
if (preempt_count() > 1) {
do_raw_spin_lock(&kernel_flag);
return;
-
--[[linux-2.6.33/preempt_count()]]
-
--[[linux-2.6.33/do_raw_spin_lock()]]
}
/*
* Otherwise, let's wait for the kernel lock
* with preemption enabled..
*/
do {
preempt_enable();
while (raw_spin_is_locked(&kernel_flag))
cpu_relax();
preempt_disable();
-
--[[linux-2.6.33/preempt_enable()]]
-
--[[linux-2.6.33/raw_spin_is_locked()]]
-
--[[linux-2.6.33/cpu_relax()]]
} while (!do_raw_spin_trylock(&kernel_flag));
}
}
**プリエンプション無効の場合 [#yad516ba]
#else
/*
* Non-preemption case - just get the spinlock
*/
static inline void __lock_kernel(void)
{
do_raw_spin_lock(&kernel_flag);
-
--[[linux-2.6.33/do_raw_spin_lock()]]
-
--[[linux-2.6.33/kernel_flag(global)]]
}
#endif
*コメント [#f9e94bf0]
終了行:
*参照元 [#ecfe8edf]
#backlinks
*説明 [#fb83445f]
-パス: [[linux-2.6.33/lib/kernel_lock.c]]
-FIXME: これは何?
--BKL(Big Kernel Lock)の 1回目のロック
**引数 [#ic341602]
-なし
**返り値 [#h4d769f8]
-なし
**参考 [#c58a66d4]
*実装 [#hf37218a]
**プリエンプション有効の場合 [#i4a1f6cf]
/*
* These are the BKL spinlocks - we try to be polite abo...
* If SMP is not on (ie UP preemption), this all goes aw...
* do_raw_spin_trylock() will always succeed.
*/
#ifdef CONFIG_PREEMPT
-
--[[linux-2.6.33/CONFIG_PREEMPT]]
static inline void __lock_kernel(void)
{
preempt_disable();
-
--[[linux-2.6.33/preempt_disable()]]
if (unlikely(!do_raw_spin_trylock(&kernel_flag))) {
-
--[[linux-2.6.33/unlikely()]]
-
--[[linux-2.6.33/do_raw_spin_trylock()]]
-
--[[linux-2.6.33/kernel_flag(global)]]
/*
* If preemption was disabled even before this
* was called, there's nothing we can be polite
* about - just spin.
*/
if (preempt_count() > 1) {
do_raw_spin_lock(&kernel_flag);
return;
-
--[[linux-2.6.33/preempt_count()]]
-
--[[linux-2.6.33/do_raw_spin_lock()]]
}
/*
* Otherwise, let's wait for the kernel lock
* with preemption enabled..
*/
do {
preempt_enable();
while (raw_spin_is_locked(&kernel_flag))
cpu_relax();
preempt_disable();
-
--[[linux-2.6.33/preempt_enable()]]
-
--[[linux-2.6.33/raw_spin_is_locked()]]
-
--[[linux-2.6.33/cpu_relax()]]
} while (!do_raw_spin_trylock(&kernel_flag));
}
}
**プリエンプション無効の場合 [#yad516ba]
#else
/*
* Non-preemption case - just get the spinlock
*/
static inline void __lock_kernel(void)
{
do_raw_spin_lock(&kernel_flag);
-
--[[linux-2.6.33/do_raw_spin_lock()]]
-
--[[linux-2.6.33/kernel_flag(global)]]
}
#endif
*コメント [#f9e94bf0]
ページ名: