All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <hawk@kernel.org>
To: Mina Almasry <almasrymina@google.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	"Shuah Khan" <shuah@kernel.org>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Ignat Korchagin" <ignat@cloudflare.com>
Subject: Re: [PATCH net-next v4] page_pool: import Jesper's page_pool benchmark
Date: Thu, 19 Jun 2025 12:24:29 +0200	[thread overview]
Message-ID: <a122981d-ac9a-4c7e-a8a3-d50a3e613f0b@kernel.org> (raw)
In-Reply-To: <CAHS8izOhNRNXyAgfuKW1xKb8PTernfer6tJfxG5FZmq7pePjwA@mail.gmail.com>



On 19/06/2025 06.19, Mina Almasry wrote:
> On Wed, Jun 18, 2025 at 5:46 AM Jesper Dangaard Brouer <hawk@kernel.org> wrote:
>>>> Something is off with benchmark numbers compared to the OOT version.
>>>>
>>>
>>> I assume you're comparing my results (my kernel config + my hardware +
>>> upstream benchmark) with your results (your kernel config + your
>>> hardware + OOT version). The problem may be in OOT vs upstream but it
>>> may be just different code/config/hardware.
>>
>> True I used OOT version.
>>
>> Just applied this patch, but I get compile error. Because Makefile tries
>> to get kernel headers (net/page_pool/helpers.h) from local Linux
>> installation instead of git tree.  This need to be adjusted for patch,
>> such that it builds with src-local/git tree provided headers.
>>
> 
> I believe the fix to that is to do:
> 
> make KDIR=$(pwd) -C ./tools/testing/selftests/net/bench
> 

Yes, this worked for me.

> I.e. the build files assume you're building the test to run it on the
> current machine, to cross compile it for a different machine under
> test, we need to pass explicit KDIR. I've kinda copy-pasted what other
> TEST_GEN_MODS_DIR= makefiles do. In theory we could do something else
> but I am guessing the way current TEST_GEN_MODS_DIR does it is the way
> to go. Does it work for you if you do that?

Yes.

> [...]
>>>
>>> Yeah, I actually just checked and I have CONFIG_DEBUG_NET on in my
>>> build, and a lot of other debug configs are turned on.
>>>
>>
>> The CONFIG_DEBUG_NET should be low overhead, so I don't expect this to
>> be the root-cause.  Other CONFIG options are more likely the issue.
>>
> 
> Thank you very much for the tips. Perf report showed the locking was
> taking forever on my kernel... I had locking debug configs enabled in
> my build... sorry... with those disabled, I get much more sane
> results:
> 
> [  185.557293] bench_page_pool: time_bench_page_pool01_fast_path():
> Cannot use page_pool fast-path
> [  185.607873] bench_page_pool: Type:no-softirq-page_pool01 Per elem: 11 cycles(tsc) 4.177 ns (step:0) - (measurement period
> time:0.041772642 sec time_interval:41772642) - (invoke count:10000000 tsc_interval:112778487)
> [  185.627090] bench_page_pool: time_bench_page_pool02_ptr_ring():
> Cannot use page_pool fast-path
> [  185.826991] bench_page_pool: Type:no-softirq-page_pool02 Per elem: 51 cycles(tsc) 19.117 ns (step:0) - (measurement period
> time:0.191178107 sec time_interval:191178107) - (invoke count:10000000 tsc_interval:516173586)
> [  185.846380] bench_page_pool: time_bench_page_pool03_slow(): Cannot
> use page_pool fast-path
> [  186.479432] bench_page_pool: Type:no-softirq-page_pool03 Per elem: 168 cycles(tsc) 62.469 ns (step:0) - (measurement period
> time:0.624690697 sec time_interval:624690697) - (invoke count:10000000 tsc_interval:1686656879)


My results with this patch:

$ sudo ./test_bench_page_pool.sh
rmmod: ERROR: Module bench_page_pool is not currently loaded
[268960.638885] bench_page_pool: Loaded
[268960.684603] bench_page_pool: Type:for_loop Per elem: 1 cycles(tsc) 
0.420 ns (step:0) - (measurement period time:0.042037752 sec 
time_interval:42037752) - (invoke count:100000000 tsc_interval:151336355)
[268961.203806] bench_page_pool: Type:atomic_inc Per elem: 18 
cycles(tsc) 5.010 ns (step:0) - (measurement period time:0.501077936 sec 
time_interval:501077936) - (invoke count:100000000 tsc_interval:1803899823)
[268961.332771] bench_page_pool: Type:lock Per elem: 39 cycles(tsc) 
11.041 ns (step:0) - (measurement period time:0.110410468 sec 
time_interval:110410468) - (invoke count:10000000 tsc_interval:397481145)
[268961.350718] bench_page_pool: time_bench_page_pool01_fast_path(): 
Cannot use page_pool fast-path
[268961.425335] bench_page_pool: Type:no-softirq-page_pool01 Per elem: 
23 cycles(tsc) 6.571 ns (step:0) - (measurement period time:0.065719390 
sec time_interval:65719390) - (invoke count:10000000 tsc_interval:236591475)
[268961.444666] bench_page_pool: time_bench_page_pool02_ptr_ring(): 
Cannot use page_pool fast-path
[268961.622103] bench_page_pool: Type:no-softirq-page_pool02 Per elem: 
60 cycles(tsc) 16.862 ns (step:0) - (measurement period time:0.168626201 
sec time_interval:168626201) - (invoke count:10000000 
tsc_interval:607060218)
[268961.641608] bench_page_pool: time_bench_page_pool03_slow(): Cannot 
use page_pool fast-path
[268962.387479] bench_page_pool: Type:no-softirq-page_pool03 Per elem: 
265 cycles(tsc) 73.739 ns (step:0) - (measurement period 
time:0.737399722 sec time_interval:737399722) - (invoke count:10000000 
tsc_interval:2654665224)

Fast path results:
no-softirq-page_pool01 Per elem: 23 cycles(tsc) 6.571 ns

ptr_ring results:
no-softirq-page_pool02 Per elem: 60 cycles(tsc) 16.862 ns

slow path results:
no-softirq-page_pool03 Per elem: 265 cycles(tsc) 73.739 ns


> Does this alleviate your concern? Or do you still see an issue here?
> There is still a delta between our results, on different
> hardware/configs but results are in a sane range now.

Now the results a sane and in range :-)

--Jesper



  reply	other threads:[~2025-06-19 10:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-15 20:59 [PATCH net-next v4] page_pool: import Jesper's page_pool benchmark Mina Almasry
2025-06-16  9:29 ` Jesper Dangaard Brouer
2025-06-16 21:11   ` Mina Almasry
2025-06-18 12:46     ` Jesper Dangaard Brouer
2025-06-19  4:19       ` Mina Almasry
2025-06-19 10:24         ` Jesper Dangaard Brouer [this message]
2025-06-19 15:37           ` Mina Almasry
2025-06-19 16:58             ` Jakub Kicinski
2025-06-19 17:05               ` Mina Almasry

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=a122981d-ac9a-4c7e-a8a3-d50a3e613f0b@kernel.org \
    --to=hawk@kernel.org \
    --cc=almasrymina@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=ignat@cloudflare.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=toke@toke.dk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.