diff mbox series

[net-next] net: page_pool: make page_pool_create inline

Message ID 499bc85ca1d96ec1f7daff6b7df4350dc50e9256.1707931443.git.lorenzo@kernel.org (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: page_pool: make page_pool_create inline | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1139 this patch: 1139
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 1007 this patch: 1007
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1170 this patch: 1170
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Lorenzo Bianconi Feb. 14, 2024, 6:01 p.m. UTC
Make page_pool_create utility routine inline a remove exported symbol.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 include/net/page_pool/types.h |  6 +++++-
 net/core/page_pool.c          | 10 ----------
 2 files changed, 5 insertions(+), 11 deletions(-)

Comments

Jakub Kicinski Feb. 14, 2024, 6:14 p.m. UTC | #1
On Wed, 14 Feb 2024 19:01:28 +0100 Lorenzo Bianconi wrote:
> Make page_pool_create utility routine inline a remove exported symbol.

But why? If you add the kdoc back the LoC saved will be 1.

>  include/net/page_pool/types.h |  6 +++++-
>  net/core/page_pool.c          | 10 ----------
>  2 files changed, 5 insertions(+), 11 deletions(-)

No strong opinion, but if you want to do it please put the helper 
in helpers.h  Let's keep the static inlines clearly separated.
Lorenzo Bianconi Feb. 14, 2024, 7:14 p.m. UTC | #2
> On Wed, 14 Feb 2024 19:01:28 +0100 Lorenzo Bianconi wrote:
> > Make page_pool_create utility routine inline a remove exported symbol.
> 
> But why? If you add the kdoc back the LoC saved will be 1.

I would remove the symbol exported since it is just a wrapper for
page_pool_create_percpu()

> 
> >  include/net/page_pool/types.h |  6 +++++-
> >  net/core/page_pool.c          | 10 ----------
> >  2 files changed, 5 insertions(+), 11 deletions(-)
> 
> No strong opinion, but if you want to do it please put the helper 
> in helpers.h  Let's keep the static inlines clearly separated.

ack, fine to me. I put it there since we already have some inlines in
page_pool/types.h.

Regards,
Lorenzo
Ilias Apalodimas March 1, 2024, 10:27 a.m. UTC | #3
Hi Lorenzo,

On Wed, 14 Feb 2024 at 21:14, Lorenzo Bianconi <lorenzo@kernel.org> wrote:
>
> > On Wed, 14 Feb 2024 19:01:28 +0100 Lorenzo Bianconi wrote:
> > > Make page_pool_create utility routine inline a remove exported symbol.
> >
> > But why? If you add the kdoc back the LoC saved will be 1.
>
> I would remove the symbol exported since it is just a wrapper for
> page_pool_create_percpu()

I don't mind either. But the explanation above must be part of the
commit message.

Thanks
/Ilias
>
> >
> > >  include/net/page_pool/types.h |  6 +++++-
> > >  net/core/page_pool.c          | 10 ----------
> > >  2 files changed, 5 insertions(+), 11 deletions(-)
> >
> > No strong opinion, but if you want to do it please put the helper
> > in helpers.h  Let's keep the static inlines clearly separated.
>
> ack, fine to me. I put it there since we already have some inlines in
> page_pool/types.h.
>
> Regards,
> Lorenzo
Jesper Dangaard Brouer March 1, 2024, 10:33 a.m. UTC | #4
On 01/03/2024 11.27, Ilias Apalodimas wrote:
> 
> On Wed, 14 Feb 2024 at 21:14, Lorenzo Bianconi <lorenzo@kernel.org> wrote:
>>
>>> On Wed, 14 Feb 2024 19:01:28 +0100 Lorenzo Bianconi wrote:
>>>> Make page_pool_create utility routine inline a remove exported symbol.
>>>
>>> But why? If you add the kdoc back the LoC saved will be 1.
>>
>> I would remove the symbol exported since it is just a wrapper for
>> page_pool_create_percpu()
> 
> I don't mind either. But the explanation above must be part of the
> commit message.

I hope my benchmark module will still work...

https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/bench_page_pool_simple.c#L181


--Jesper
Ilias Apalodimas March 1, 2024, 10:40 a.m. UTC | #5
Hi Jesper,

On Fri, 1 Mar 2024 at 12:33, Jesper Dangaard Brouer <hawk@kernel.org> wrote:
>
>
>
> On 01/03/2024 11.27, Ilias Apalodimas wrote:
> >
> > On Wed, 14 Feb 2024 at 21:14, Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> >>
> >>> On Wed, 14 Feb 2024 19:01:28 +0100 Lorenzo Bianconi wrote:
> >>>> Make page_pool_create utility routine inline a remove exported symbol.
> >>>
> >>> But why? If you add the kdoc back the LoC saved will be 1.
> >>
> >> I would remove the symbol exported since it is just a wrapper for
> >> page_pool_create_percpu()
> >
> > I don't mind either. But the explanation above must be part of the
> > commit message.
>
> I hope my benchmark module will still work...
>
> https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/bench_page_pool_simple.c#L181

Since we rely on this so much, perhaps we should make an effort to
merge it, even in a version that only works for x86.
I know it's fairly easy to compile and run locally, but having it as
part of the CI is better -- more people will be able to look at the
results quickly and determine if we have a performance degradation

Cheers
/Ilias
>
>
> --Jesper
diff mbox series

Patch

diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
index 3828396ae60c..0057e584df9a 100644
--- a/include/net/page_pool/types.h
+++ b/include/net/page_pool/types.h
@@ -203,9 +203,13 @@  struct page_pool {
 struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp);
 struct page *page_pool_alloc_frag(struct page_pool *pool, unsigned int *offset,
 				  unsigned int size, gfp_t gfp);
-struct page_pool *page_pool_create(const struct page_pool_params *params);
 struct page_pool *page_pool_create_percpu(const struct page_pool_params *params,
 					  int cpuid);
+static inline struct page_pool *
+page_pool_create(const struct page_pool_params *params)
+{
+	return page_pool_create_percpu(params, -1);
+}
 
 struct xdp_mem_info;
 
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 89c835fcf094..6e0753e6a95b 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -289,16 +289,6 @@  page_pool_create_percpu(const struct page_pool_params *params, int cpuid)
 }
 EXPORT_SYMBOL(page_pool_create_percpu);
 
-/**
- * page_pool_create() - create a page pool
- * @params: parameters, see struct page_pool_params
- */
-struct page_pool *page_pool_create(const struct page_pool_params *params)
-{
-	return page_pool_create_percpu(params, -1);
-}
-EXPORT_SYMBOL(page_pool_create);
-
 static void page_pool_return_page(struct page_pool *pool, struct page *page);
 
 noinline