diff mbox series

[net-next,v9,2/4] page_pool: halve BIAS_MAX for multiple user references of a fragment

Message ID 20231212044614.42733-3-liangchen.linux@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series skbuff: Optimize SKB coalescing for page pool | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
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: 1117 this patch: 1117
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 1143 this patch: 1143
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: 1144 this patch: 1144
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 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

Liang Chen Dec. 12, 2023, 4:46 a.m. UTC
Referring to patch [1], in order to support multiple users referencing the
same fragment and prevent overflow from pp_ref_count growing, the initial
value of pp_ref_count is halved, leaving room for pp_ref_count to increment
before the page is drained.

[1]
https://lore.kernel.org/all/20211009093724.10539-3-linyunsheng@huawei.com/

Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 net/core/page_pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mina Almasry Dec. 13, 2023, 1:51 a.m. UTC | #1
On Mon, Dec 11, 2023 at 8:47 PM Liang Chen <liangchen.linux@gmail.com> wrote:
>
> Referring to patch [1], in order to support multiple users referencing the
> same fragment and prevent overflow from pp_ref_count growing, the initial
> value of pp_ref_count is halved, leaving room for pp_ref_count to increment
> before the page is drained.
>
> [1]
> https://lore.kernel.org/all/20211009093724.10539-3-linyunsheng@huawei.com/
>
> Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
> Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>

Reviewed-by: Mina Almasry <almarsymina@google.com>

> ---
>  net/core/page_pool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 106220b1f89c..436f7ffea7b4 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -26,7 +26,7 @@
>  #define DEFER_TIME (msecs_to_jiffies(1000))
>  #define DEFER_WARN_INTERVAL (60 * HZ)
>
> -#define BIAS_MAX       LONG_MAX
> +#define BIAS_MAX       (LONG_MAX >> 1)
>
>  #ifdef CONFIG_PAGE_POOL_STATS
>  /* alloc_stat_inc is intended to be used in softirq context */
> --
> 2.31.1
>
>
Ilias Apalodimas Dec. 13, 2023, 11:38 a.m. UTC | #2
Hi Liang,

On Tue, 12 Dec 2023 at 06:47, Liang Chen <liangchen.linux@gmail.com> wrote:
>
> Referring to patch [1], in order to support multiple users referencing the
> same fragment and prevent overflow from pp_ref_count growing, the initial
> value of pp_ref_count is halved, leaving room for pp_ref_count to increment
> before the page is drained.
>
> [1]
> https://lore.kernel.org/all/20211009093724.10539-3-linyunsheng@huawei.com/

We only need this if patch #4 is merged.  In that case, I'd like to
describe the changelog a bit better.
Something along the lines of
"Up to now, we were only subtracting from the number of used page
fragments to figure out when a page could be freed or recycled. A
following patch introduces support for multiple users referencing the
same fragment. So reduce the initial page fragments value to half to
avoid overflowing"

Thanks
/Ilias
> same fragment



>
> Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
> Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>
> ---
>  net/core/page_pool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 106220b1f89c..436f7ffea7b4 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -26,7 +26,7 @@
>  #define DEFER_TIME (msecs_to_jiffies(1000))
>  #define DEFER_WARN_INTERVAL (60 * HZ)
>
> -#define BIAS_MAX       LONG_MAX
> +#define BIAS_MAX       (LONG_MAX >> 1)
>
>  #ifdef CONFIG_PAGE_POOL_STATS
>  /* alloc_stat_inc is intended to be used in softirq context */
> --
> 2.31.1
>
Liang Chen Dec. 14, 2023, 3:42 a.m. UTC | #3
On Wed, Dec 13, 2023 at 7:39 PM Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Liang,
>
> On Tue, 12 Dec 2023 at 06:47, Liang Chen <liangchen.linux@gmail.com> wrote:
> >
> > Referring to patch [1], in order to support multiple users referencing the
> > same fragment and prevent overflow from pp_ref_count growing, the initial
> > value of pp_ref_count is halved, leaving room for pp_ref_count to increment
> > before the page is drained.
> >
> > [1]
> > https://lore.kernel.org/all/20211009093724.10539-3-linyunsheng@huawei.com/
>
> We only need this if patch #4 is merged.  In that case, I'd like to
> describe the changelog a bit better.
> Something along the lines of
> "Up to now, we were only subtracting from the number of used page
> fragments to figure out when a page could be freed or recycled. A
> following patch introduces support for multiple users referencing the
> same fragment. So reduce the initial page fragments value to half to
> avoid overflowing"
>

Sure. Thanks for the suggestion!

> Thanks
> /Ilias
> > same fragment
>
>
>
> >
> > Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
> > Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>
> > ---
> >  net/core/page_pool.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > index 106220b1f89c..436f7ffea7b4 100644
> > --- a/net/core/page_pool.c
> > +++ b/net/core/page_pool.c
> > @@ -26,7 +26,7 @@
> >  #define DEFER_TIME (msecs_to_jiffies(1000))
> >  #define DEFER_WARN_INTERVAL (60 * HZ)
> >
> > -#define BIAS_MAX       LONG_MAX
> > +#define BIAS_MAX       (LONG_MAX >> 1)
> >
> >  #ifdef CONFIG_PAGE_POOL_STATS
> >  /* alloc_stat_inc is intended to be used in softirq context */
> > --
> > 2.31.1
> >
diff mbox series

Patch

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 106220b1f89c..436f7ffea7b4 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -26,7 +26,7 @@ 
 #define DEFER_TIME (msecs_to_jiffies(1000))
 #define DEFER_WARN_INTERVAL (60 * HZ)
 
-#define BIAS_MAX	LONG_MAX
+#define BIAS_MAX	(LONG_MAX >> 1)
 
 #ifdef CONFIG_PAGE_POOL_STATS
 /* alloc_stat_inc is intended to be used in softirq context */