From: Yonghong Song <yonghong.song@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
Hou Tao <houtao1@huawei.com>, Jakub Kicinski <kuba@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
"David S. Miller" <davem@davemloft.net>,
Network Development <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Subject: Re: [GIT PULL v2] Networking for 6.7
Date: Thu, 9 Nov 2023 10:41:43 -0800 [thread overview]
Message-ID: <9ac86e10-e8b7-4eee-a8c4-c58397c1606a@linux.dev> (raw)
In-Reply-To: <CAADnVQJtc6JJZMXuZ0M5_0A3=N-TJuYO2vMofJmK6KLhWrBAPg@mail.gmail.com>
On 11/9/23 10:18 AM, Alexei Starovoitov wrote:
> On Thu, Nov 9, 2023 at 10:09 AM Yonghong Song <yonghong.song@linux.dev> wrote:
>>
>> On 11/9/23 8:14 AM, Kirill A. Shutemov wrote:
>>> On Thu, Nov 09, 2023 at 08:01:39AM -0800, Alexei Starovoitov wrote:
>>>> On Thu, Nov 9, 2023 at 7:49 AM Kirill A. Shutemov <kirill@shutemov.name> wrote:
>>>>> On Tue, Oct 31, 2023 at 02:09:48PM -0700, Jakub Kicinski wrote:
>>>>>> bpf: Add support for non-fix-size percpu mem allocation
>>>>> Recent changes in BPF increased per-CPU memory consumption a lot.
>>>>>
>>>>> On virtual machine with 288 CPUs, per-CPU consumtion increased from 111 MB
>>>>> to 969 MB, or 8.7x.
>>>>>
>>>>> I've bisected it to the commit 41a5db8d8161 ("bpf: Add support for
>>>>> non-fix-size percpu mem allocation"), which part of the pull request.
>>>> Hmm. This is unexpected. Thank you for reporting.
>>>>
>>>> How did you measure this 111 MB vs 969 MB ?
>>>> Pls share the steps to reproduce.
>>> Boot VMM with 288 (qemu-system-x86_64 -smp 288) and check Percpu: field of
>>> /proc/meminfo.
>> I did some experiments with my VM. My VM currently supports up to 255 cpus,
>> so I tried 4/32/252 number of cpus. For a particular number of cpus, two
>> experiments are done:
>> (1). bpf-percpu-mem-prefill
>> (2). no-bpf-percpu-mem-prefill
>>
>> For 4 cpu:
>> bpf-percpu-mem-prefill:
>> Percpu: 2000 kB
>> no-bpf-percpu-mem-prefill:
>> Percpu: 1808 kB
>>
>> bpf-percpu-mem-prefill percpu cost: (2000 - 1808)/4 KB = 48KB
>>
>> For 32 cpus:
>> bpf-percpu-mem-prefill:
>> Percpu: 25344 kB
>> no-bpf-percpu-mem-prefill:
>> Percpu: 14464 kB
>>
>> bpf-percpu-mem-prefill percpu cost: (25344 - 14464)/4 KB = 340KB
>>
>> For 252 cpus:
>> bpf-percpu-mem-prefill:
>> Percpu: 230912 kB
>> no-bpf-percpu-mem-prefill:
>> Percpu: 57856 kB
>>
>> bpf-percpu-mem-prefill percpu cost: (230912 - 57856)/4 KB = 686KB
>>
>> I am not able to reproduce the dramatic number from 111 MB to 969 MB.
>> My number with 252 cpus is from ~58MB to ~231MB.
> Even 231MB is way too much. We shouldn't be allocating that much.
> Let's switch to on-demand allocation. Only when bpf progs that
> user per-cpu are loaded.
Sounds good. Will craft a patch for this.
next prev parent reply other threads:[~2023-11-09 18:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-28 1:17 [GIT PULL] Networking for 6.7 Jakub Kicinski
2023-10-30 23:15 ` Jakub Kicinski
2023-10-31 21:09 ` [GIT PULL v2] " Jakub Kicinski
2023-10-31 22:57 ` Linus Torvalds
2023-11-01 1:18 ` [GIT PULL] Networking follow up " Jakub Kicinski
2023-11-02 2:51 ` [GIT PULL v2] Networking " pr-tracker-bot
2023-11-09 15:49 ` Kirill A. Shutemov
2023-11-09 16:01 ` Alexei Starovoitov
2023-11-09 16:14 ` Kirill A. Shutemov
2023-11-09 18:09 ` Yonghong Song
2023-11-09 18:18 ` Alexei Starovoitov
2023-11-09 18:41 ` Yonghong Song [this message]
2023-11-14 13:30 ` Linux regression tracking #adding (Thorsten Leemhuis)
2023-10-31 23:00 ` [GIT PULL] " pr-tracker-bot
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=9ac86e10-e8b7-4eee-a8c4-c58397c1606a@linux.dev \
--to=yonghong.song@linux.dev \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=davem@davemloft.net \
--cc=houtao1@huawei.com \
--cc=kirill@shutemov.name \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).