[커널 17차 A-2조] 15주차
2020.12.06 01:45
init/main.c
start_kernel 진행 중
1) debug_objects_early_init()
- obj_hash의 spin lock 초기화 및 obj_pool에 obj_static_pool 추가
- list_head 자료구조 : 리눅스 커널의 연결리스트 정리 | Unknown (wordpress.com)
The Linux Kernel API — The Linux Kernel documentation
- hlist_head : hash table을 위한 doubly linked list 자료 구조
Linux Kernel Data Structure - Hash List · Jiaquan He (hejq.me)
2) cgroup_init_early()
- init_cgroup_root() 진행 중
- WRITE_ONCE() 매크로
: compiletime_assert_rwonce_type(x) : x의 type이 현재 architecture에서 atomic access 가능한 단위인지 체크. 예외적으로 long long type은 atomic type이 아니어도 build 허용. 그 외엔 build 실패하고 메시지를 출력함.
: __WRITE_ONCE(x, val) : val을 x에 쓰되 x를 volatile로 access함. 동일한 volatile 변수에 대한 접근한 compiler가 순서를 보장해주는 것으로 보임. 이를 통해 __WRITE_ONCE 이후 __READ_ONCE가 사용될 때 순서가 보장됨.
(예 : list_del_init() 이후에 list_empty()가 호출되는 경우
관련 사이트 : kernel/git/torvalds/linux.git - Linux kernel source tree
Volatiles (Using the GNU Compiler Collection (GCC))
- atomic_set() : atomic_t 자료구조, WRITE_ONCE로 구현됨
- init_cgroup_housekeeping()
- mutex_init() : mutex 초기화
: mutex 자료구조
- atomic_long_t owner : mutex 점유 중인 task 주소 저장
- spinlock_t wait_lock : mutex를 잡기 위한 spinlock. spinlock은 atomic_t와 locked, pending, tail이 union되어 있음.
- optimistic_spin_queue osq : tail task의 CPU number 저장?
- mutex를 기다리는 task의 list
- prev_cputime_init()
- for_each_subsys 매크로
- init_waitqueue_head()
- INIT_WORK() 매크로
cgroup 관련 내용
1장. 컨트롤 그룹 (Cgroups) 소개 Red Hat Enterprise Linux 6 | Red Hat Customer Portal
Linux cgroups에 대해 알아보자 1 - Lab of ryul99 (torch.vision)
mutex 관련 내용
- mutex_lock() 실행 시 atomic operation 기반의 fast mutex lock을 먼저 시도하고 이후 spinlock 또는 sleep 방식의 slow lock을 시도함.
- atomic operation은 cmpxchg 연산을 사용하며 ARM v8.1 이후부터 cmpxchg는 CAS 명령어로 구현됨
- MCS_LOCK : MCS Lock 이해하기 & 구현 :: Live like penguin (tistory.com)
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
공지 | [공지] 스터디 정리 노트 공간입니다. | woos | 2016.05.14 | 630 |
247 | 커널 스터디 공개 노트 링크 [1] | 박동하 | 2016.05.20 | 233140 |
246 | [커널 17차] 41주차 | ㅇㅇㅇ | 2021.06.13 | 36552 |
245 | [커널 17차] 56주차 | ㅇㅇㅇ | 2021.10.03 | 27530 |
244 | [커널 18차] 1주차 | V4bel | 2021.05.29 | 3600 |
243 | [커널 17차 6조] 2주차 | 김정근 | 2020.08.31 | 2175 |
242 | [커널 17차 2조] 4주차 | wellbeing | 2020.09.12 | 1518 |
241 | 커널 스터디 13차 D조 스터디 로그 링크입니다. | 목태양 | 2016.05.15 | 1226 |
240 | 해킹&보안 1차 A팀 스터디로그 링크 | 수비니겨 | 2016.05.19 | 1185 |
239 | [커널 16차 B조] 1주차 [1] | kdy0252 | 2019.05.25 | 1084 |
238 | [커널 17차 A조] 20주차 | 주영 | 2021.01.11 | 1019 |
237 | [커널 20차] 24주차 | 이민찬 | 2023.10.22 | 814 |
236 | [커널 17차 2조] 5주차 | wellbeing | 2020.09.19 | 739 |
235 | [커널 17차 8조] 1주차 [3] | JSYoo5B | 2020.08.22 | 716 |
234 | [커널 19차] 0주차 - 오리엔테이션 | 리턴 | 2022.05.07 | 602 |
233 | [커널 17차] 26주차 | 주영 | 2021.03.01 | 540 |
232 | [커널 19차] 37 주차 | Min | 2023.02.04 | 479 |
231 | [커널 19차] 1주차 | 리턴 | 2022.05.16 | 457 |
230 | [커널 17차] 32주차 | ㅇㅇㅇ | 2021.04.11 | 444 |
229 | [커널 17차 A조] 12주차 | 주영 | 2020.11.16 | 410 |
.