On Thu, May 18, 2023 at 10:25 AM Kent Overstreet <kent.overstreet@xxxxxxxxx> wrote: > > On Thu, May 18, 2023 at 10:15:59AM -0700, Song Liu wrote: > > On Thu, May 18, 2023 at 9:58 AM Kent Overstreet > > <kent.overstreet@xxxxxxxxx> wrote: > > > > > > On Thu, May 18, 2023 at 09:33:20AM -0700, Song Liu wrote: > > > > I am working on patches based on the discussion in [1]. I am planning to > > > > send v1 for review in a week or so. > > > > > > For reference, here's my own (early, but functioning :) slab allocator: > > > > > > Look forward to comparing! > > > > This looks similar to the bpf_prog_pack allocator we use for BPF at the > > moment. (search for bpf_prog_pack in kernel/bpf/core.c). I guess we > > can also use bpf_prog_pack for bcachefs for now. > > The code in bpf/core.c does a _lot_, my preference would be to split > that up and refactor the bpf code to use something generic :) The code is actually splitted into two parts: bpf_prog_pack_[alloc|free] vs. bpf_jit_binary_pack_[alloc|free]. The latter has logic just for BPF. But the former can be reused by other users (maybe with a little refactoring). Once the vmap_area based solution is committed, we will replace the former with the new allocator. Thanks, Song