• R
    bpf: sched: basic infrastructure for scheduler bpf · d93afd18
    Roman Gushchin 提交于
    maillist inclusion
    category: feature
    bugzilla: https://gitee.com/openeuler/kernel/issues/I5F6X6
    CVE: NA
    
    Reference: https://lore.kernel.org/all/20210916162451.709260-1-guro@fb.com/
    
    -------------------
    
    This commit introduces basic definitions and infrastructure for
    scheduler bpf programs. It defines the BPF_PROG_TYPE_SCHED program
    type and the BPF_SCHED attachment type.
    
    The implementation is inspired by lsm bpf programs and is based on
    kretprobes. This will allow to add new hooks with a minimal changes to
    the kernel code and without any changes to libbpf/bpftool.
    It's very convenient as I anticipate a large number of private patches
    being used for a long time before (or if at all) reaching upstream.
    
    Sched programs are expected to return an int, which meaning will be
    context defined.
    
    This patch doesn't add any real scheduler hooks (only a stub), it will
    be done by following patches in the series.
    
    Scheduler bpf programs as now are very restricted in what they can do:
    only the bpf_printk() helper is available. The scheduler context can
    impose significant restrictions on what's safe and what's not. So
    let's extend their abilities on case by case basis when a need arise.
    Signed-off-by: NRoman Gushchin <guro@fb.com>
    Signed-off-by: NChen Hui <judy.chenhui@huawei.com>
    Signed-off-by: NRen Zhijie <renzhijie2@huawei.com>
    d93afd18
bpf.h 184.8 KB