
From: Gu Bowen <gubowen5@huawei.com> hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICA1GK -------------------------------- Add kfunc to get the number of poisoned pages. Co-developed-by: GONG Ruiqi <gongruiqi1@huawei.com> Signed-off-by: GONG Ruiqi <gongruiqi1@huawei.com> Signed-off-by: Gu Bowen <gubowen5@huawei.com> --- kernel/bpf-rvi/common_kfuncs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/bpf-rvi/common_kfuncs.c b/kernel/bpf-rvi/common_kfuncs.c index f97ac2197a97..5fbe3472fb88 100644 --- a/kernel/bpf-rvi/common_kfuncs.c +++ b/kernel/bpf-rvi/common_kfuncs.c @@ -229,6 +229,11 @@ __bpf_kfunc int bpf_hugetlb_report_meminfo(struct bpf_mem_hugepage *hugepage_inf } #endif +__bpf_kfunc unsigned long bpf_mem_failure(void) +{ + return atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10); +} + BTF_SET8_START(bpf_common_kfuncs_ids) BTF_ID_FLAGS(func, bpf_mem_cgroup_from_task, KF_RET_NULL | KF_RCU) BTF_ID_FLAGS(func, bpf_task_active_pid_ns, KF_TRUSTED_ARGS) @@ -251,6 +256,7 @@ BTF_ID_FLAGS(func, bpf_mem_kreclaimable) BTF_ID_FLAGS(func, bpf_mem_totalcma) BTF_ID_FLAGS(func, bpf_mem_freecma) BTF_ID_FLAGS(func, bpf_hugetlb_report_meminfo, KF_TRUSTED_ARGS) +BTF_ID_FLAGS(func, bpf_mem_failure) BTF_SET8_END(bpf_common_kfuncs_ids) static const struct btf_kfunc_id_set bpf_common_kfuncs_set = { -- 2.25.1