BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>,
	Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH bpf-next v6 3/8] bpf: Allow per unit prefill for non-fix-size percpu memory allocator
Date: Wed, 3 Jan 2024 23:01:48 -0800	[thread overview]
Message-ID: <1db29e2f-907f-40e9-8039-ba0c6cef92c4@linux.dev> (raw)
In-Reply-To: <CAADnVQJTFo0tgZRhgv7k28zNAvgnqjWaLvNNhcy+oiqdfvTvpw@mail.gmail.com>


On 1/3/24 9:21 PM, Alexei Starovoitov wrote:
> On Thu, Dec 21, 2023 at 7:18 PM Yonghong Song <yonghong.song@linux.dev> wrote:
>>
>> Later on, Commit 1fda5bb66ad8 ("bpf: Do not allocate percpu memory
>> at init stage") moved the non-fix-size percpu memory allocation
>> to bpf verificaiton stage.
> Only noticed after already applying and didn't want to force push
> to fix it up.
> But in the future please do not break commit one-liner into
> multiple lines. Commit should be lower case as well.

Sorry about the format issue. Will pay attention to this next time
and as you suggested, will run spellcheck as well.

>
> spellcheck is a good idea as well.
>
>> +
>> +       for_each_possible_cpu(cpu) {
>> +               cc = per_cpu_ptr(pcc, cpu);
>> +               c = &cc->cache[i];
>> +               if (cpu == 0 && c->unit_size)
>> +                       break;
> I think this part ensures that repeated
> bpf_percpu_obj_new() in a bpf prog don't keep prefilling,
> right?
> I think it works, but cpu == 0 part is confusing.
> It will work with just: if (c->unit_size) break;
> right?

You are right. cpu == 0 is a leftover from one of
previous revisions and should be removed. Will send
a followup to remove it.

>
>> +
>> +               c->unit_size = unit_size;
>> +               c->objcg = objcg;
>> +               c->percpu_size = percpu_size;
>> +               c->tgt = c;
>> +
>> +               init_refill_work(c);
>> +               prefill_mem_cache(c, cpu);
>> +       }
>> +
>> +       return 0;
>> +}

  reply	other threads:[~2024-01-04  7:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  3:17 [PATCH bpf-next v6 0/8] bpf: Reduce memory usage for bpf_global_percpu_ma Yonghong Song
2023-12-22  3:17 ` [PATCH bpf-next v6 1/8] bpf: Avoid unnecessary extra percpu memory allocation Yonghong Song
2023-12-22  3:17 ` [PATCH bpf-next v6 2/8] bpf: Add objcg to bpf_mem_alloc Yonghong Song
2023-12-22  3:17 ` [PATCH bpf-next v6 3/8] bpf: Allow per unit prefill for non-fix-size percpu memory allocator Yonghong Song
2023-12-22  9:36   ` Hou Tao
2024-01-04  5:21   ` Alexei Starovoitov
2024-01-04  7:01     ` Yonghong Song [this message]
2023-12-22  3:17 ` [PATCH bpf-next v6 4/8] bpf: Refill only one percpu element in memalloc Yonghong Song
2023-12-22  3:17 ` [PATCH bpf-next v6 5/8] bpf: Use smaller low/high marks for percpu allocation Yonghong Song
2023-12-22  9:36   ` Hou Tao
2023-12-22  3:18 ` [PATCH bpf-next v6 6/8] bpf: Limit up to 512 bytes for bpf_global_percpu_ma allocation Yonghong Song
2023-12-22  3:18 ` [PATCH bpf-next v6 7/8] selftests/bpf: Cope with 512 bytes limit with bpf_global_percpu_ma Yonghong Song
2023-12-22  3:18 ` [PATCH bpf-next v6 8/8] selftests/bpf: Add a selftest with > 512-byte percpu allocation size Yonghong Song
2023-12-22  9:35 ` [PATCH bpf-next v6 0/8] bpf: Reduce memory usage for bpf_global_percpu_ma Hou Tao
2023-12-28  0:49   ` Yonghong Song
2024-01-04  5:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1db29e2f-907f-40e9-8039-ba0c6cef92c4@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox