netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: netdev@vger.kernel.org
Cc: linyunsheng@huawei.com, Jesper Dangaard Brouer <hawk@kernel.org>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] page_pool: Rename frag_users to frag_cnt
Date: Fri, 15 Dec 2023 09:43:03 +0200	[thread overview]
Message-ID: <CAC_iWjLYu7En7-2sVAxFtNwhvqhrRPqJmbPR_C-YL5wD2Cfe6w@mail.gmail.com> (raw)
In-Reply-To: <20231215073119.543560-1-ilias.apalodimas@linaro.org>

On Fri, 15 Dec 2023 at 09:31, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Since [0] got merged, it's clear that 'pp_ref_count' is used to track
> the number of users for each page. On struct_page though we have
> a member called 'frag_users'. Despite of what the name suggests this is
> not the number of users. It instead represents the number of fragments of
> the current page. When we have a single page this is set to one.

Replying to myself here, but this is a typo. On single pages, we set
pp_ref_count to one, not this.

>  When we
> split the page this is set to the actual number of frags and later used
> in page_pool_drain_frag() to infer the real number of users.
>
> So let's rename it to something that matches the description above
>
> [0]
> Link: https://lore.kernel.org/netdev/20231212044614.42733-2-liangchen.linux@gmail.com/
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  include/net/page_pool.h | 2 +-
>  net/core/page_pool.c    | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/net/page_pool.h b/include/net/page_pool.h
> index 813c93499f20..957cd84bb3f4 100644
> --- a/include/net/page_pool.h
> +++ b/include/net/page_pool.h
> @@ -158,7 +158,7 @@ struct page_pool {
>         u32 pages_state_hold_cnt;
>         unsigned int frag_offset;
>         struct page *frag_page;
> -       long frag_users;
> +       long frag_cnt;
>
>  #ifdef CONFIG_PAGE_POOL_STATS
>         /* these stats are incremented while in softirq context */
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 9b203d8660e4..19a56a52ac8f 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -659,7 +659,7 @@ EXPORT_SYMBOL(page_pool_put_page_bulk);
>  static struct page *page_pool_drain_frag(struct page_pool *pool,
>                                          struct page *page)
>  {
> -       long drain_count = BIAS_MAX - pool->frag_users;
> +       long drain_count = BIAS_MAX - pool->frag_cnt;
>
>         /* Some user is still using the page frag */
>         if (likely(page_pool_defrag_page(page, drain_count)))
> @@ -678,7 +678,7 @@ static struct page *page_pool_drain_frag(struct page_pool *pool,
>
>  static void page_pool_free_frag(struct page_pool *pool)
>  {
> -       long drain_count = BIAS_MAX - pool->frag_users;
> +       long drain_count = BIAS_MAX - pool->frag_cnt;
>         struct page *page = pool->frag_page;
>
>         pool->frag_page = NULL;
> @@ -721,14 +721,14 @@ struct page *page_pool_alloc_frag(struct page_pool *pool,
>                 pool->frag_page = page;
>
>  frag_reset:
> -               pool->frag_users = 1;
> +               pool->frag_cnt = 1;
>                 *offset = 0;
>                 pool->frag_offset = size;
>                 page_pool_fragment_page(page, BIAS_MAX);
>                 return page;
>         }
>
> -       pool->frag_users++;
> +       pool->frag_cnt++;
>         pool->frag_offset = *offset + size;
>         alloc_stat_inc(pool, fast);
>         return page;
> --
> 2.37.2
>

  reply	other threads:[~2023-12-15  7:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  7:31 [PATCH net-next] page_pool: Rename frag_users to frag_cnt Ilias Apalodimas
2023-12-15  7:43 ` Ilias Apalodimas [this message]
2023-12-15 11:09 ` Yunsheng Lin
2023-12-15 11:58   ` Ilias Apalodimas
2023-12-15 12:34     ` Yunsheng Lin
2023-12-20  7:56       ` Ilias Apalodimas
2023-12-21  2:07         ` Yunsheng Lin
2023-12-21  6:37           ` Ilias Apalodimas
2023-12-21  7:59             ` Yunsheng Lin
2023-12-21  8:24               ` Ilias Apalodimas
2023-12-21  9:39                 ` Yunsheng Lin

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=CAC_iWjLYu7En7-2sVAxFtNwhvqhrRPqJmbPR_C-YL5wD2Cfe6w@mail.gmail.com \
    --to=ilias.apalodimas@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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).