Compare commits

...

2 Commits

Author SHA1 Message Date
I-Hsin Cheng
a6c2d8a79a
Merge 2f334dba85 into b313a96714 2024-11-29 23:57:06 +08:00
I Hsin Cheng
2f334dba85 scx_rusty: Refactor access operation of nodemask
Within "task_set_preferred_mempolicy_dom_mask", it tries to access the
nodemask of the task directly. BPF verifier might not allow it under all
situation.

Use BPF_CORE_READ() macro to let libbpf handle CO-RE relocate to make
sure it can pass the verifier.

Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
2024-11-28 22:08:58 +08:00

View File

@ -1264,7 +1264,6 @@ static void task_set_preferred_mempolicy_dom_mask(struct task_struct *p,
{ {
u32 node_id; u32 node_id;
u32 val = 0; u32 val = 0;
nodemask_t *node_mask = &p->mempolicy->nodes;
void *mask; void *mask;
taskc->preferred_dom_mask = 0; taskc->preferred_dom_mask = 0;
@ -1286,7 +1285,7 @@ static void task_set_preferred_mempolicy_dom_mask(struct task_struct *p,
return; return;
} }
mask = BPF_CORE_READ(node_mask, bits); mask = BPF_CORE_READ(p, mempolicy, nodes.bits);
if (bpf_core_read(&val, sizeof(val), mask)) if (bpf_core_read(&val, sizeof(val), mask))
return; return;