V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
xinmans
V2EX  ›  Linux

如何学习 Linux 内核代码?

  •  
  •   xinmans · 128 天前 via iPhone · 709 次点击
    这是一个创建于 128 天前的主题,其中的信息可能已经有所发展或是发生改变。
    今天发现我的蜗牛星际的 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.
    */
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2725 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 11:22 · PVG 19:22 · LAX 04:22 · JFK 07:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.