Re: [PATCH v2 bpf-next 2/7] bpf: use bytes instead of pages for bpf_jit_[charge|uncharge]_modmem

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

 




> On Dec 15, 2021, at 12:56 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> 
> On Tue, Dec 14, 2021 at 10:00:57PM -0800, Song Liu wrote:
>> From: Song Liu <songliubraving@xxxxxx>
>> 
>> This enables sub-page memory charge and allocation.
>> 
>> Signed-off-by: Song Liu <songliubraving@xxxxxx>
>> ---
>> include/linux/bpf.h     |  4 ++--
>> kernel/bpf/core.c       | 19 +++++++++----------
>> kernel/bpf/trampoline.c |  6 +++---
>> 3 files changed, 14 insertions(+), 15 deletions(-)
>> 
>> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
>> index 965fffaf0308..adcdda0019f1 100644
>> --- a/include/linux/bpf.h
>> +++ b/include/linux/bpf.h
>> @@ -775,8 +775,8 @@ void bpf_image_ksym_add(void *data, struct bpf_ksym *ksym);
>> void bpf_image_ksym_del(struct bpf_ksym *ksym);
>> void bpf_ksym_add(struct bpf_ksym *ksym);
>> void bpf_ksym_del(struct bpf_ksym *ksym);
>> -int bpf_jit_charge_modmem(u32 pages);
>> -void bpf_jit_uncharge_modmem(u32 pages);
>> +int bpf_jit_charge_modmem(u32 size);
>> +void bpf_jit_uncharge_modmem(u32 size);
>> bool bpf_prog_has_trampoline(const struct bpf_prog *prog);
>> #else
>> static inline int bpf_trampoline_link_prog(struct bpf_prog *prog,
>> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
>> index de3e5bc6781f..495e3b2c36ff 100644
>> --- a/kernel/bpf/core.c
>> +++ b/kernel/bpf/core.c
>> @@ -808,7 +808,7 @@ int bpf_jit_add_poke_descriptor(struct bpf_prog *prog,
>> 	return slot;
>> }
>> 
>> -static atomic_long_t bpf_jit_current;
>> +static atomic64_t bpf_jit_current;
> 
> atomic64_t is atrocious crap on much of 32bit. I suppose it doesn't
> matter since this is slow path accounting?

Yeah, speed shouldn't matter for bpf_jit_charge|uncharge(). 

Thanks,
Song




[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