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

From: Song Liu
Date: Wed Jan 19 2022 - 23:45:31 EST




> On Jan 19, 2022, at 8:10 PM, Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Wed, Jan 19, 2022 at 03:06:15PM -0800, Song Liu wrote:
>> From: Song Liu <songliubraving@xxxxxx>
>>
>> This enables sub-page memory charge and allocation.
>>
>> Signed-off-by: Song Liu <songliubraving@xxxxxx>
>>
[...]
>> @@ -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;
>
> I don't understand the motivation for this change.
> bpf_jit_limit is type "long" and it's counting in bytes.
> So why change jit_current to atomic64?
> atomic_long will be fine even on 32-bit arch.
> What did I miss?

Hmm.. I think you are right. I guess I missed the fact that we use
long bpf_jit_limit. Will remove this change in the next version.

Thanks,
Song