Minor page faults in non-sleepable programs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am working on a bpf program of type perf_event (thus, it can't be
sleepable). This program needs to be able to unwind the user-mode stack
of the current task, which of course involves reading stack memory.

In most cases, this works fine with bpf_probe_read_user. However, in
some cases, it causes page faults, even when the relevant pages are
resident in memory (and thus accessing them shouldn't cause a sleep).

One example of when this can happen is when running on a NUMA system. If
the process is migrated to a core on a different NUMA node, eventually
Linux's numa balancing feature will kick in and the task's stack pages
will be migrated to the proper node. When this happens, there will be a
(minor) page fault the next time the process accesses the page so that
the mapping in its virtual address space can be updated. But if a page
is _never_ accessed again by the process, then bpf_probe_read_user for
addresses in that page will always fail.

Is there any workaround for cases like this, or is it simply impossible?

One possible direction could be to allow bpf_probe_read_user to incur
_minor_ page faults, but not _major_ ones, but I don't know whether that
would actually be possible.

-- 
Brennan (he/him)
Staff Software Engineer | Polar Signals Inc.
P: +16238249252
E: brennan.vincent@xxxxxxxxxxxxxxxx
W: umanwizard.com
TZ: America/New_York




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux