> + * > + * Returns 1 if the forward progress was achieved and some memory was freed. > + * Returns a negative value if an error has been occurred. s/has been occurred/has occurred or occured > + */ > +__bpf_kfunc int bpf_out_of_memory(struct mem_cgroup *memcg__nullable, > + int order, bool wait_on_oom_lock) > +{ > + struct oom_control oc = { > + .memcg = memcg__nullable, > + .order = order, > + }; > + int ret; > + > + if (oc.order < 0 || oc.order > MAX_PAGE_ORDER) > + return -EINVAL; > + > + if (wait_on_oom_lock) { > + ret = mutex_lock_killable(&oom_lock); > + if (ret) > + return ret; > + } else if (!mutex_trylock(&oom_lock)) > + return -EBUSY; > + > + ret = out_of_memory(&oc); > + > + mutex_unlock(&oom_lock); > + return ret; > +} > + > __bpf_kfunc_end_defs(); > > BTF_KFUNCS_START(bpf_oom_kfuncs) > BTF_ID_FLAGS(func, bpf_oom_kill_process, KF_SLEEPABLE | KF_TRUSTED_ARGS) > +BTF_ID_FLAGS(func, bpf_out_of_memory, KF_SLEEPABLE | KF_TRUSTED_ARGS) > BTF_KFUNCS_END(bpf_oom_kfuncs) > > static const struct btf_kfunc_id_set bpf_oom_kfunc_set = { > -- > 2.50.1 >