如何学习 Linux 内核代码?

140 天前
 xinmans
今天发现我的蜗牛星际的 PT 下载 qb 因为内存不足被系统 oom-killer 了,但是系统的 8G 内存我发现并没有用完,在 1.8G 的时候 killed ,kill 完后掉到了 1.2G ,qb 只用了 0.6G 内存,所以想调查下原因,同时阅读了下 oom-killer.c 源码,发现作者提到是 this file will double as a 'coding guide' and a signpost for newbie kernel hackers ,因此想请教 Linux 内核大拿们如何阅读,比如我想借着 oom 这个 case 实际看下上下文机制。有没有好的入门的文档可以指引源码学习,甚至是自己修改编译测试


https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/mm/oom_kill.c?h=v5.4.265

// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/mm/oom_kill.c
*
* Copyright (C) 1998,2000 Rik van Riel
* Thanks go out to Claus Fischer for some serious inspiration and
* for goading me into coding this file...
* Copyright (C) 2010 Google, Inc.
* Rewritten by David Rientjes
*
* The routines in this file are used to kill a process when
* we're seriously out of memory. This gets called from __alloc_pages()
* in mm/page_alloc.c when we really run out of memory.
*
* Since we won't call these routines often (on a well-configured
* machine) this file will double as a 'coding guide' and a signpost
* for newbie kernel hackers. It features several pointers to major
* kernel subsystems and hints as to where to find out what things do.
*/
726 次点击
所在节点    Linux
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1002210

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX