Re: [PATCH bpf-next 2/5] bpf: Implement cgroup storage available to non-cgroup-attached bpf progs

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

 



On 10/17/22 11:01 AM, sdf@xxxxxxxxxx wrote:
+static bool bpf_cgroup_storage_trylock(void)
+{
+    migrate_disable();
+    if (unlikely(this_cpu_inc_return(bpf_cgroup_storage_busy) != 1)) {
+        this_cpu_dec(bpf_cgroup_storage_busy);
+        migrate_enable();
+        return false;
+    }
+    return true;
+}

Task storage has lock/unlock/trylock; inode storage doesn't; why does
cgroup need it as well?

This was added in bc235cdb423a2 to avoid deadlock for tracing program which can get a hold to the same task ptr easily with bpf_get_current_task_btf(). I believe there was no known way to hit this problem in inode storage, so inode storage does not use it.

The common tracing use case to get a hold of the cgroup ptr is through task (including bpf_get_current_task_btf()), so it seems to make sense to mimic the trylock here. I have plan to relax it for all non-tracing programs like cgroup-bpf and bpf-lsm.



[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