![](/img/trans.png)
[英]How can I clear thread affinity with sched_setaffinity meaning I want to give control back to the kernel?
[英]How I can include the /kernel/sched/* into a BPF program?
根據 BPF Performance Tools 一書,我正在嘗試在 Linux 中使用 bpftrace 制作一個自定義 bpf 程序。 我試圖從路徑 linux/kernel/sched/sched.h 中包含一些文件。 我怎樣才能包括它們? (不僅是 /include 文件夾,還來自 Linux 中的 linux/kernel/* 文件夾?)
我正在嘗試合並#include /kernel/sched/sched.h 以使用“struct rq”。
我的程序示例是:
#!/usr/local/bin/bpftrace
#include <kernel/sched/sched.h>
kprobe:load_balance
{
$rq = (struct rq *)arg1;
printf("-------------------\n");
printf("\n");
printf("load_balance: %s pid: %d\n", comm, pid);
printf("-------------------\n");
}
header 沒有公開,所以如果你想使用它或它的任何字段,你必須在你自己的程序中復制rq
結構定義。
這種定義副本已經存在於 bpftrace 的示例中,例如struct cfs_rq_partial
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.