invitation to kernel parameter and code exploration
DESCRIPTION
Invitation fo "Linux Kernel parameter reading" at YLUG#107. Kernel source code exploration and history tracking based on each kernel parameter.TRANSCRIPT
![Page 1: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/1.jpg)
<予告>カーネルパラメータ読書会
for YLUG#107, 2011/5/31
@tyamadajp
![Page 2: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/2.jpg)
カーネルパラメータ
質問:どれだけある?
![Page 3: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/3.jpg)
カーネルパラメータ
質問:どれだけある?
# sysctl -a | wc -l1807# sysctl -a | \perl -pe 's/\d+/X/g;s/=.*$//' | \sort | uniq | wc -l1104
![Page 4: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/4.jpg)
カーネルパラメータ
質問:どれだけある?
# sysctl -a | wc -l1807# sysctl -a | \perl -pe 's/\d+/X/g;s/=.*$//' | \sort | uniq | wc -l1104
モジュールによって更に追加されるものの、吊るしの PC でもこんなにある
![Page 5: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/5.jpg)
パラメータについて調べたい!
そんなあなたに:
- kernel-parameters.txt- networking/ip-sysctl.txt- その他 Documentation/ の下
優しいカーネルハッカーのお兄さん達が説明してくれてます!
![Page 6: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/6.jpg)
パラメータについて調べたい!
そんなあなたに:
- kernel-parameters.txt- networking/ip-sysctl.txt- その他 Documentation/ の下
優しいカーネルハッカーのお兄さん達が説明してくれてます!そんな風に考えていた時期が・・・
俺にもありました・・・
![Page 7: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/7.jpg)
さわるな危険・・・でも
基本:あんまりいじらない
→ 明確に必要なアプリなら、 きちんと案内がある( DB 系とか)→ あまり変な値をセットしたりすると システムが不思議な踊りを!→ 搭載リソース量から自動で 設定されるよう書かれていたり
そうは言っても知りたい事も
![Page 8: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/8.jpg)
さわるな危険・・・でも知りたい
実益:→ リソース枯渇で止まった後に 知るより、止まる前に知るべき
趣味(?):→ 実世界のニーズがあるから (一部やむなく)存在する訳で、 これを起点にソースを読むのは 勉強になる(かもしれない)
![Page 9: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/9.jpg)
たとえば・・・ここでクイズ
以下のパラメータはper-kernel? それとも per-container?
・ kernel.msgmax・ kernel.threads-max・ net.core.somaxconn・ sunrpc.tcp_fin_timeout
cgroup namespace
![Page 10: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/10.jpg)
たとえば・・・ここでクイズ
以下のパラメータはper-kernel? それとも per-container?
・ kernel.msgmax → per-c・ kernel.threads-max・ net.core.somaxconn・ sunrpc.tcp_fin_timeout
![Page 11: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/11.jpg)
たとえば・・・ここでクイズ(1)
以下のパラメータはper-kernel? それとも per-container?
・ kernel.msgmax → per-c・ kernel.threads-max → per-k・ net.core.somaxconn・ sunrpc.tcp_fin_timeout
![Page 12: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/12.jpg)
たとえば・・・ここでクイズ(1)
以下のパラメータはper-kernel? それとも per-container?
・ kernel.msgmax → per-c・ kernel.threads-max → per-k・ net.core.somaxconn → per-c・ sunrpc.tcp_fin_timeout → per-k
試せば判ることだけど、まとまってるといいよね?
![Page 13: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/13.jpg)
まとめてみました
まだ 500 個くらい
![Page 14: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/14.jpg)
まとめてみてよかったこと
辞書を読む楽しみ、のような… 「こんなパラメータがあったのか」
例: crypto.fips_enabled →暗号化・乱数生成系の厳格さを FIP-120 準拠にします(矛盾を 発見すると即 panic する)
![Page 15: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/15.jpg)
調べてみてわかったこと
ここを探せばわかる:→ ソースとコメント(当然)→ パッチを投げたメール→ その人が他で投げたメール→ その人が他で書いた資料・論文
$ grep -ri crypto.fips_enabled \ Documentation/$
![Page 16: Invitation to Kernel Parameter and Code Exploration](https://reader036.vdocuments.pub/reader036/viewer/2022081820/545cef2ab1af9f280a8b492b/html5/thumbnails/16.jpg)
これから
こういった k-p.txt の翻訳ではない、
パラメータを起点にした カーネル探検
を細々とやってきたいので、一緒にやりたい方、いかがですか?