今天发现我的蜗牛星际的 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.
*/