在使用PREEMPT RT时,源文件可分为两种形式:一个大的patch文件包含所有功能;或一系列分离的patch文件,每个只实现特定的功能,例如https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/[version]/patches***.xz。每个patch文件中都有各自实现功能的简要介绍。
- blk-mq-Don-t-complete-on-a-remote-CPU-in-force-threa.patch 在block mq中,中断线程化模式下,禁用remote CPU处理request。
- crash-add-VMCOREINFO-macro-to-define-offset-in-a-str.patch 为通过typedef 定义的class,实现与VMCOREINFO_OFFSET相同的功能,命名为VMCOREINFO_TYPE_OFFSET。
- locking-rtmux-Remove-cruft.patch 删除rt_mutex的无用成员。
- printk-refactor-kmsg_dump_get_buffer.patch,在printk.c中重构kmsg_dump_get_buffer(), 使之更接近syslog_print_all()的实现。
- Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch(共四个子patch),在mm/page_alloc.c中,在free page时,将IRQ-off section分成两部分,先isolate_pcp_pages(), 再free_pcppages_bulk()。PCP意思是per_cpu_pages。
- stop_machine-Add-function-and-caller-debug-info.patch,在stop-machine crash时,更容易地找到calling code信息。
- time_sched_clock_Use-raw_read_seqcount_latch-during-.patch在time/sched_clock.c中,采用性能更好的raw_read_seqcount_latch()代替raw_read_seqcount()。seqcount和顺序锁有关。
- blk-mq-Always-complete-remote-completions-requests-i.patch在block mq中,用softirq处理request。
- locking-rtmutex-Remove-output-from-deadlock-detector.patch,lockdep是检测死锁更好的方法,删除rtmutex中用于检测死锁的bebug打印信息。
- mm-swap-Do-not-abuse-the-seqcount_t-latching-API.patch 在mm/swap.c中,重构lru-add_drain_all(),避免滥用seqcount_t。
- printk-add-lockless-ringbuffer.patch,kernel/printk/printk_ringbuffer.c中为内核log数据引入multi-reader multi-writer lockless的ring buffer。
- printk-use-buffer-pools-for-sprint-buffers.patch,用per-cpu和global pool的方式实现printk的static buffer。实现printk递归,以及per-cpu没有ready的时候使能printk()。
- sched-Fix-balance_callback.patch,sched_core.c 修复balance_callback()中的若干漏洞。
To be continued.
本文详细介绍了PREEMPT RT在Linux内核中的实现原理,涉及多个关键补丁的解析,包括中断处理优化、内存分配改进、死锁检测和打印函数的性能提升等方面,旨在增强系统的实时性和稳定性。
578

被折叠的 条评论
为什么被折叠?



