[lkml]   [2021]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 3/3] bpf: Implement prealloc for task_local_storage

On Fri, Oct 22, 2021 at 03:47:33PM -0700, Martin KaFai Lau wrote:
> > + for_each_process_thread(g, p) {
> I am thinking if this loop can be done in bpf iter.
> If the bpf_local_storage_map is sleepable safe (not yet done but there is
> an earlier attempt [0]), bpf_local_storage_update() should be able to
> alloc without GFP_ATOMIC by sleepable bpf prog and this potentially
> will be useful in general for other sleepable use cases.
> For example, if a sleepable bpf iter prog can run in this loop (or the existing
> bpf task iter loop is as good?), the iter bpf prog can call
> bpf_task_storage_get(BPF_SK_STORAGE_GET_F_CREATE) on a sleepable
> bpf_local_storage_map.

Yeah, whatever that can walk all the existing tasks should do, and I think
the locked section can be shrunk too.

list_add_tail(&smap->prealloc_node, &prealloc_smaps);

// Here, it's guaranteed that all new tasks are guaranteed to
// prealloc on fork.

Iterate all tasks in whatever way and allocate if necessary;



 \ /
  Last update: 2021-10-23 01:01    [W:0.060 / U:2.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site