Re: [PATCH bpf-next v2 2/3] bpf: struct_ops supports more than one page for trampolines.

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

 



On 2/23/24 10:29 AM, Kui-Feng Lee wrote:
One thing I forgot to mention is that bpf_dummy_ops has to call
bpf_jit_uncharge_modmem(PAGE_SIZE) as well. The other option is to move
bpf_jit_charge_modmem() out of bpf_struct_ops_prepare_trampoline(),
meaning bpf_struct_ops_map_update_elem() should handle the case that the
allocation in bpf_struct_ops_prepare_trampoline() successes, but
bpf_jit_charge_modmem() fails.

Keep the charge/uncharge in bpf_struct_ops_prepare_trampoline().

It is fine to have bpf_dummy_ops charge and then uncharge a PAGE_SIZE. There is no need to optimize for bpf_dummy_ops. Use bpf_struct_ops_free_trampoline() in bpf_dummy_ops to uncharge and free.


void bpf_struct_ops_free_trampoline(void *image)
{
     bpf_jit_uncharge_modmem(PAGE_SIZE);
     arch_free_bpf_trampoline(image, PAGE_SIZE);
}






[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