*参照元 [#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 about preemption.
  * If SMP is not on (ie UP preemption), this all goes away because the
  * 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]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS