摘要:
原文:https://www.kernel.org/doc/html/latest/admin-guide/mm/concepts.html The memory management in Linux is a complex system that evolved over the years
阅读全文
posted @ 2023-12-04 20:54
dolinux
阅读(138)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/core-api/workqueue.html Introduction There are many cases where an asynchronous process execution context is
阅读全文
posted @ 2023-12-04 16:57
dolinux
阅读(114)
推荐(0)
摘要:
下面是trace扩展的项目地址: https://github.com/fujitsu/crash-trace 如果已经编译安装过crash,可以直接编译,然后使用extend工具加载. 加载模块 crash> extend /mnt/crash-trace/trace.so /mnt/crash-
阅读全文
posted @ 2023-12-03 22:06
dolinux
阅读(305)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/filesystems/vfs.html#overview-of-the-linux-virtual-file-system Introduction The Virtual File System (also kn
阅读全文
posted @ 2023-12-02 20:51
dolinux
阅读(327)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html What is the magic SysRq key? 什么是魔术SysRq键? It is a 'magical' key combo you can hit whi
阅读全文
posted @ 2023-12-01 21:21
dolinux
阅读(136)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html Objective 目标 Performance critical computing applications dealing with large me
阅读全文
posted @ 2023-12-01 19:29
dolinux
阅读(213)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/kernel-hacking/false-sharing.html What is False Sharing 什么是伪共享 False sharing is related with cache mechanism
阅读全文
posted @ 2023-12-01 11:01
dolinux
阅读(123)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/admin-guide/mm/hugetlbpage.html 内核中内存管理文档汇总:Memory Management Overview The intent of this file is to give a
阅读全文
posted @ 2023-12-01 10:37
dolinux
阅读(259)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/admin-guide/lockup-watchdogs.html The Linux kernel can act as a watchdog to detect both soft and hard lockup
阅读全文
posted @ 2023-11-30 21:06
dolinux
阅读(170)
推荐(0)
摘要:
原文: https://www.kernel.org/doc/html/latest/admin-guide/numastat.html /sys/devices/system/node/node*/numastat All units are pages. Hugepages have separ
阅读全文
posted @ 2023-11-30 16:04
dolinux
阅读(66)
推荐(0)
摘要:
http://t.csdnimg.cn/zvjEx
阅读全文
posted @ 2023-11-29 11:30
dolinux
阅读(38)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/admin-guide/mm/numa_memory_policy.html What is NUMA Memory Policy? In the Linux kernel, "memory policy" dete
阅读全文
posted @ 2023-11-27 21:48
dolinux
阅读(490)
推荐(0)
摘要:
作者 内核代码 kernel\async.c include/linux/async.h 用途 Linux内核中的异步函数调用机制,其目标是通过并行执行来减少内核启动时间。在系统启动时,一些操作(如硬件延迟和发现操作)可以以非严格的顺序并行执行,从而实现异步处理。 该机制的关键概念是“序列cooki
阅读全文
posted @ 2023-11-26 11:38
dolinux
阅读(970)
推荐(0)
posted @ 2023-11-26 11:17
dolinux
阅读(48)
推荐(0)
摘要:
官网 Android Open Source Project 搭建构建环境 ubuntu18及以上:sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 li
阅读全文
posted @ 2023-11-11 11:38
dolinux
阅读(406)
推荐(0)
摘要:
流程图 模块数据的拷贝过程 首先从磁盘上打开,然后将文件fd传给内核,内核会将模块文件的内容拷贝到一个通过vmalloc分配的临时虚拟内存中,执行完一些检查后,再将模块内容拷贝到最终的虚拟内存中,然后进行重定位。最后的这块虚拟内存可以通过module_alloc也可以通过vzalloc分配,一般会调
阅读全文
posted @ 2023-11-09 17:18
dolinux
阅读(157)
推荐(0)
摘要:
原文:https://www.kernel.org/doc/html/latest/RCU/Design/Expedited-Grace-Periods/Expedited-Grace-Periods.html A Tour Through TREE_RCU's Expedited Grace Pe
阅读全文
posted @ 2023-11-06 22:25
dolinux
阅读(208)
推荐(0)
摘要:
原文: https://docs.kernel.org/RCU/Design/Memory-Ordering/Tree-RCU-Memory-Ordering.html August 8, 2017 This article was contributed by Paul E. McKenney I
阅读全文
posted @ 2023-11-06 19:47
dolinux
阅读(118)
推荐(0)
摘要:
有时我们有这样的需求,想查看某个进程的内核栈里的全部内容,介绍下面的几种做法: 方法1:得到进程的栈底地址以及栈大小,然后使用rd指令读取 使用mach指令获取内核栈的大小 crash> mach | grep SIZE MEMORY SIZE: 64 GB PAGE SIZE: 4096 KERN
阅读全文
posted @ 2023-11-04 20:51
dolinux
阅读(897)
推荐(0)
摘要:
作者 pengdonglin137@163.com 正文 uftrace专门用来跟踪用户态的C/C++以及Rust程序的执行,此外它也支持跟踪内核函数。 前一篇文章bpf_func_id是如何产生的?是以minimal为例,下面用uftrace跟踪一下执行流。为了可以让uftrace更好的工作,需要
阅读全文
posted @ 2023-11-02 17:19
dolinux
阅读(172)
推荐(1)
摘要:
作者 pengdonglin137@163.com 正文 以libbpf-bootstrap中的一个测试程序minimal.bpf.c为例。 下面是minimal.bpf.c的源码: minimal.bpf.c // SPDX-License-Identifier: GPL-2.0 OR BSD-3
阅读全文
posted @ 2023-11-01 23:26
dolinux
阅读(241)
推荐(0)
摘要:
目录EFLAGS/RFLAGSpush和pop操作异常和中断 EFLAGS/RFLAGS intel手册:3.4.3 EFLAGS Register push和pop操作 x86_64架构中,push和pop指令用于将数据压入栈中或从栈中弹出数据。具体运行过程如下: push指令的运行过程:(先减)
阅读全文
posted @ 2023-11-01 18:47
dolinux
阅读(126)
推荐(0)
摘要:
当我们知道某个数组的地址,可以使用下面的方法连续输出若干个数组成员的值,而不用每次手动计算下一个数组成员的地址,这里的数组地址可以是直接的内存地址,也可以是一个全局的符号名。 示例 /* page结构体在内存中是连续存放的,如果知道了一个page的地址,下面的 例子连续输出从指定的page开始的连续
阅读全文
posted @ 2023-10-31 17:13
dolinux
阅读(250)
推荐(0)
摘要:
参考 https://www.kernel.org/doc/html/latest/process/submitting-patches.html https://git-scm.com/docs/pretty-formats 如下所示: 做法 配置git [core] abbrev = 12 [p
阅读全文
posted @ 2023-10-30 15:19
dolinux
阅读(52)
推荐(0)
摘要:
参考 https://www.kernel.org/doc/html/latest/core-api/idr.html https://www.kernel.org/doc/html/latest/core-api/xarray.html 正文 在写内核代码时,可能会需要给数据结构分配一个唯一的ID
阅读全文
posted @ 2023-10-27 23:28
dolinux
阅读(383)
推荐(0)
摘要:
平台 ubuntu20.04 问题 在linux内核源码目录下执行下面的命令时: root@ubuntu-vm:/mnt/linux-6.5/tools/testing/selftests/bpf# make 报如下错误: progs/verifier_netfilter_retcode.c:41:
阅读全文
posted @ 2023-10-22 17:23
dolinux
阅读(79)
推荐(0)
摘要:
有时我们知道了一个文件的file或者dentry地址,想知道对应的文件的路径,下面介绍两种方法: file 如果知道的是file的地址,可以使用files命令: crash> foreach files | grep ffff88824243e000 1 ffff88824243e000 ffff8
阅读全文
posted @ 2023-10-21 20:59
dolinux
阅读(176)
推荐(0)
摘要:
参考 DDI0487J_a_a-profile_architecture_reference_manual.pdf B2.3 Definition of the Arm memory model B2.3.12 Memory barriers Data Memory Barrier (DMB) Da
阅读全文
posted @ 2023-10-21 15:10
dolinux
阅读(244)
推荐(0)
摘要:
参考 DDI0487J_a_a-profile_architecture_reference_manual.pdf D7: The AArch64 System Level Memory Model D7.5 Cache support D7.5.8 About cache maintenance
阅读全文
posted @ 2023-10-21 14:46
dolinux
阅读(82)
推荐(0)
摘要:
参考资料 DDI0487J_a_a-profile_architecture_reference_manual.pdf B2.3.12 Memory barriers Shareability and access limitations on the data barrier operations
阅读全文
posted @ 2023-10-21 14:32
dolinux
阅读(108)
推荐(0)
摘要:
作者 pengdonglin137@163.com 现象 在一台ARM64的Centos7虚拟机里加载 https://github.com/504ensicsLabs/LiME 编译出的内核模块时发生宕机: insmod lime.ko path=/root/allmem.dump format=
阅读全文
posted @ 2023-10-19 22:58
dolinux
阅读(696)
推荐(0)
摘要:
有时我们得到了某个结构体的地址,这个结构体内部有一个指向另外一个数据结构的指针,那么如何快速输出另外一个数据的内容。 这里有两种方法,还是以task_struct为例,我想输出mm成员的内容: 方法1 根据结构体的地址输出指针成员的值,然后再进行二次引用 crash> *task_struct.mm
阅读全文
posted @ 2023-09-24 21:41
dolinux
阅读(330)
推荐(0)
摘要:
以下面的task_struct为例: crash> *task_struct -ox ffff893e3846e000 struct task_struct { [ffff893e3846e000] struct thread_info thread_info; [ffff893e3846e010]
阅读全文
posted @ 2023-09-24 21:29
dolinux
阅读(230)
推荐(0)
摘要:
方法1 使用ps获取进程的task_struct地址,然后得到mm_struct地址 crash> ps | grep bash 6666 96253 8 ffff88a07fd42000 IN 0.0 24268 3048 bash 8288 59636 14 ffff88fdc4678000 I
阅读全文
posted @ 2023-09-24 18:41
dolinux
阅读(303)
推荐(0)
摘要:
crash提供了vm命令来输出进程的vma相关的信息。 输出当前当进程的vma列表 crash> vm PID: 3319 TASK: ffff889760358000 CPU: 6 COMMAND: "kvm" MM PGD RSS TOTAL_VM ffff893ada165000 ffff89
阅读全文
posted @ 2023-09-24 18:19
dolinux
阅读(215)
推荐(0)
摘要:
在linux系统中可以通过/proc/slabinfo获取slab的统计数据,crash提供了kmem来实现这个功能。 查看系统每个kmem_cache的概要信息 crash> kmem -s CACHE OBJSIZE ALLOCATED TOTAL SLABS SSIZE NAME ffff88
阅读全文
posted @ 2023-09-24 16:47
dolinux
阅读(318)
推荐(0)
摘要:
将page的flags转换为可读字符串 crash> kmem -g 01fffe00000a001c FLAGS: 1fffe00000a001c PAGE-FLAG BIT VALUE PG_referenced 2 0000004 PG_uptodate 3 0000008 PG_dirty
阅读全文
posted @ 2023-09-24 15:49
dolinux
阅读(79)
推荐(0)
摘要:
linux中page数据结构可以通过mem_map数组访问,下面的方法可以输出每个page的相关成员。 通用版本 下面这个命令可以显示每个page的一些关键成员的值。 crash> kmem -p PAGE PHYSICAL MAPPING INDEX CNT FLAGS ffffea0000000
阅读全文
posted @ 2023-09-24 15:13
dolinux
阅读(232)
推荐(0)
摘要:
crash> kmem -n NODE SIZE PGLIST_DATA BOOTMEM_DATA NODE_ZONES 0 100925439 ffff88e03ffc1000 ffff88e03ffc1000 ffff88e03ffc5000 ffff88e03ffc9000 ffff88e03
阅读全文
posted @ 2023-09-24 15:04
dolinux
阅读(98)
推荐(0)
摘要:
crash> kmem -v VMAP_AREA VM_STRUCT ADDRESS RANGE SIZE ffff88debf51c900 ffff88debf53bd00 ffffc90000000000 - ffffc90000002000 8192 ffff88debf51cf60 ffff
阅读全文
posted @ 2023-09-24 14:40
dolinux
阅读(80)
推荐(0)