[커널 17차 A조] 21주차

2021.01.18 19:52

주영 조회 수:155

2020년 1월 16일

 

linux version : mainline 5.9

 

init/main.c.  start_kernel();

 

setup_arch(); 분석중

setup_machine_fdt() 분석 

 

early_init_dt_scan_nodes 내부 분석

early_init_dt_scan_root

early_init_dt_scan_memory 

 

(kernel/jump_label.c)

jump_label_init(); 분석

 

/*

* Since we are initializing the static_key.enabled field with

* with the 'raw' int values (to avoid pulling in atomic.h) in

* jump_label.h, let's make sure that is safe. There are only two

* cases to check since we initialize to 0 or 1.

*/

BUILD_BUG_ON((int)ATOMIC_INIT(0) != 0);

BUILD_BUG_ON((int)ATOMIC_INIT(1) != 1);

 

이러한 작업을 하는 이유 (추측입니다.)

기존의 atomic.h의 의존성을 제거하지만 기능을 제거하지 않는 것으로 판단.

atomic_init(0) 과 0이 같은지 비교하고 atomic_init(0)을 모두 0으로 바꾼다.

빌드 시 한 번만 하기 위해 c파일에 설정한 것으로 보인다.

 

if (static_key_initialized)

    return;

이 부분은 이미 설정 되어 있는 경우 진행하지 않고 종료한다.

jump_label_init이 미리 호출 되는 경우가 있다고 한다. arm이 미리 호출 되는 경우이며,

setup_arch 이후에 jump_label_init을 한 번 더 호출한다.

 

cpus_read_lock(); 진행. 세마포어 생략. 추후 구조를 볼 예정

 

저녁 시간

 

이론 분석 - RCU

 

https://lwn.net/Articles/262464/ (What is RCU, Fundamentally?) (1월 2일 분석)

https://lwn.net/Articles/263130/ (What is RCU? Part 2: Usage) (1월 16일 분석)

https://lwn.net/Articles/264090/#So,%20What%20is%20RCU%20Really? (RCU part 3: the RCU API) (추후 예정)

 

https://kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html (보류, 다루지 않을 예정)

 

자료

https://github.com/iamroot17A/linux

XE Login