mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Mina Almasry <almasrymina@google.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"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>
Subject: Re: [PATCH net-next v3] page_pool: import Jesper's page_pool benchmark
Date: Sat, 14 Jun 2025 10:08:53 -0700	[thread overview]
Message-ID: <20250614100853.3f2372f2@kernel.org> (raw)
In-Reply-To: <20250613234420.1613060-1-almasrymina@google.com>

On Fri, 13 Jun 2025 23:44:20 +0000 Mina Almasry wrote:
> From: Jesper Dangaard Brouer <hawk@kernel.org>
> 
> We frequently consult with Jesper's out-of-tree page_pool benchmark to
> evaluate page_pool changes.
> 
> Import the benchmark into the upstream linux kernel tree so that (a)
> we're all running the same version, (b) pave the way for shared
> improvements, and (c) maybe one day integrate it with nipa, if possible.
> 
> Import bench_page_pool_simple from commit 35b1716d0c30 ("Add
> page_bench06_walk_all"), from this repository:
> https://github.com/netoptimizer/prototype-kernel.git
> 
> Changes done during upstreaming:
> - Fix checkpatch issues.

There is more:

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#81: 
new file mode 100644

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#122: FILE: tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:1:
+/*

CHECK: Please use a blank line after function/struct/union/enum declarations
#163: FILE: tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:42:
+};
+#define bit(b)		(1 << (b))

WARNING: Block comments use a trailing */ on a separate line
#172: FILE: tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:51:
+ * introduced by the for loop itself */

WARNING: Prefer kcalloc over kzalloc with multiply
#238: FILE: tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:117:
+	array = kzalloc(sizeof(struct page *) * elems, gfp_mask);

WARNING: braces {} are not necessary for single statement blocks
#240: FILE: tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:119:
+	for (i = 0; i < elems; i++) {
+		array[i] = page_pool_alloc_pages(pp, gfp_mask);
+	}

WARNING: braces {} are not necessary for single statement blocks
#243: FILE: tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:122:
+	for (i = 0; i < elems; i++) {
+		_page_pool_put_page(pp, array[i], false);
+	}

WARNING: line length of 81 exceeds 80 columns
#288: FILE: tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:167:
+		/* Common fast-path alloc, that depend on in_serving_softirq() */

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#402: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:1:
+/*

WARNING: line length of 81 exceeds 80 columns
#451: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:50:
+ * Architectures Software Developer’s Manual Volume 3: System Programming Guide

CHECK: Alignment should match open parenthesis
#491: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:90:
+		perf_event = perf_event_create_kernel_counter(&perf_conf, cpu,
+						 NULL /* task */,

CHECK: spaces preferred around that '|' (ctx:VxV)
#626: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:225:
+	rec.flags       = (TIME_BENCH_LOOP|TIME_BENCH_TSC|TIME_BENCH_WALLCLOCK);
 	                                  ^

CHECK: spaces preferred around that '|' (ctx:VxV)
#626: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:225:
+	rec.flags       = (TIME_BENCH_LOOP|TIME_BENCH_TSC|TIME_BENCH_WALLCLOCK);
 	                                                 ^

CHECK: Lines should not end with a '('
#743: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:342:
+void time_bench_run_concurrent(

CHECK: spaces preferred around that '|' (ctx:VxV)
#772: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:371:
+		c->rec.flags       = (TIME_BENCH_LOOP|TIME_BENCH_TSC|
 		                                     ^

CHECK: space preferred before that '|' (ctx:VxE)
#772: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:371:
+		c->rec.flags       = (TIME_BENCH_LOOP|TIME_BENCH_TSC|
 		                                                    ^

WARNING: Missing a blank line after declarations
#801: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.c:400:
+		struct time_bench_cpu *c = &cpu_tasks[cpu];
+		kthread_stop(c->task);

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#814: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:1:
+/*

WARNING: please, no space before tabs
#829: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:16:
+^Iuint32_t flags; ^I/* Measurements types enabled */$

CHECK: spaces preferred around that '<<' (ctx:VxV)
#830: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:17:
+#define TIME_BENCH_LOOP		(1<<0)
                        		  ^

CHECK: Prefer using the BIT macro
#830: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:17:
+#define TIME_BENCH_LOOP		(1<<0)

CHECK: spaces preferred around that '<<' (ctx:VxV)
#831: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:18:
+#define TIME_BENCH_TSC		(1<<1)
                       		  ^

CHECK: Prefer using the BIT macro
#831: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:18:
+#define TIME_BENCH_TSC		(1<<1)

CHECK: spaces preferred around that '<<' (ctx:VxV)
#832: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:19:
+#define TIME_BENCH_WALLCLOCK	(1<<2)
                             	  ^

CHECK: Prefer using the BIT macro
#832: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:19:
+#define TIME_BENCH_WALLCLOCK	(1<<2)

CHECK: spaces preferred around that '<<' (ctx:VxV)
#833: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:20:
+#define TIME_BENCH_PMU		(1<<3)
                       		  ^

CHECK: Prefer using the BIT macro
#833: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:20:
+#define TIME_BENCH_PMU		(1<<3)

WARNING: please, no space before tabs
#838: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:25:
+^Iuint64_t invoked_cnt; ^I/* Returned actual invocations */$

WARNING: Block comments use a trailing */ on a separate line
#844: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:31:
+	 * instructions counter including pipelined instructions */

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#917: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:104:
+	unsigned hi, lo;

WARNING: Missing a blank line after declarations
#918: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:105:
+	unsigned hi, lo;
+	asm volatile("CPUID\n\t"

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#930: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:117:
+	unsigned hi, lo;

WARNING: Missing a blank line after declarations
#931: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:118:
+	unsigned hi, lo;
+	asm volatile("RDTSCP\n\t"

WARNING: Block comments use * on subsequent lines
#955: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:142:
+/*
+inline uint64_t rdtsc(void)

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#997: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:184:
+static __always_inline unsigned long long p_rdpmc(unsigned in)

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#999: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:186:
+	unsigned d, a;

CHECK: Lines should not end with a '('
#1038: FILE: tools/testing/selftests/net/bench/page_pool/time_bench.h:225:
+void time_bench_run_concurrent(

WARNING: line length of 113 exceeds 80 columns
#1097: FILE: tools/testing/selftests/net/bench/test_bench_page_pool.sh:19:
+	echo ${result} | grep -o -E "no-softirq-page_pool01 Per elem: ([0-9]+) cycles\(tsc\) ([0-9]+\.[0-9]+) ns"

WARNING: line length of 113 exceeds 80 columns
#1101: FILE: tools/testing/selftests/net/bench/test_bench_page_pool.sh:23:
+	echo ${result} | grep -o -E "no-softirq-page_pool02 Per elem: ([0-9]+) cycles\(tsc\) ([0-9]+\.[0-9]+) ns"

WARNING: line length of 113 exceeds 80 columns
#1105: FILE: tools/testing/selftests/net/bench/test_bench_page_pool.sh:27:
+	echo ${result} | grep -o -E "no-softirq-page_pool03 Per elem: ([0-9]+) cycles\(tsc\) ([0-9]+\.[0-9]+) ns"

total: 0 errors, 33 warnings, 17 checks, 995 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 12b4bc1bc38a ("page_pool: import Jesper's page_pool benchmark") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT BAD_REPORTED_BY_LINK CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 33 warnings, 17 checks, 995 lines checked

> diff --git a/tools/testing/selftests/net/bench/page_pool/time_bench.c b/tools/testing/selftests/net/bench/page_pool/time_bench.c
> new file mode 100644
> index 000000000000..257b1515c64e
> --- /dev/null
> +++ b/tools/testing/selftests/net/bench/page_pool/time_bench.c
> @@ -0,0 +1,406 @@
> +/*
> + * Benchmarking code execution time inside the kernel
> + *
> + * Copyright (C) 2014, Red Hat, Inc., Jesper Dangaard Brouer
> + *  for licensing details see kernel-base/COPYING

don't think kernel-base/COPYING exists

coccicheck also says:

testing/tools/testing/selftests/net/bench/page_pool/time_bench.c:57:36-37: WARNING: Use ARRAY_SIZE
testing/tools/testing/selftests/net/bench/page_pool/bench_page_pool_simple.c:223:5-17: Unneeded variable: "passed_count". Return "0" on line 245

IIUC the former is in user space code, but maybe we can add a define
for ARRAY_SIZE and use it? It's pretty trivial.
-- 
pw-bot: cr

      reply	other threads:[~2025-06-14 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 23:44 Mina Almasry
2025-06-14 17:08 ` Jakub Kicinski [this message]

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=20250614100853.3f2372f2@kernel.org \
    --to=kuba@kernel.org \
    --cc=almasrymina@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ilias.apalodimas@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®