netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
	<kernel-team@fb.com>, <ilias.apalodimas@linaro.org>,
	brouer@redhat.com
Subject: Re: [net-next PATCH v2 1/2] page_pool: do not release pool until inflight == 0.
Date: Thu, 14 Nov 2019 22:27:53 +0100	[thread overview]
Message-ID: <20191114222753.03e50613@carbon> (raw)
In-Reply-To: <20191114163715.4184099-2-jonathan.lemon@gmail.com>

On Thu, 14 Nov 2019 08:37:14 -0800
Jonathan Lemon <jonathan.lemon@gmail.com> wrote:

> The page pool keeps track of the number of pages in flight, and
> it isn't safe to remove the pool until all pages are returned.
> 
> Disallow removing the pool until all pages are back, so the pool
> is always available for page producers.

I like this patch.
 
> Make the page pool responsible for its own delayed destruction
> instead of relying on XDP, so the page pool can be used without
> the xdp memory model.
> 
> When all pages are returned, free the pool and notify xdp if the
> pool is registered with the xdp memory system.  Have the callback
> perform a table walk since some drivers (cpsw) may share the pool
> among multiple xdp_rxq_info.
> 
> Note that the increment of pages_state_release_cnt may result in
> inflight == 0, releasing the pool.

Maybe we can just do the atomic_inc_return trick, and this patch can
itself can go in.

Alternative is to release the pool via RCU, like the xa
structure is freed via RCU (which have a pointer to the pool).


> Fixes: d956a048cd3f ("xdp: force mem allocator removal and periodic warning")
> Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
> ---

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer


  reply	other threads:[~2019-11-14 21:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 16:37 [net-next PATCH v2 0/2] Change page_pool timeout handling Jonathan Lemon
2019-11-14 16:37 ` [net-next PATCH v2 1/2] page_pool: do not release pool until inflight == 0 Jonathan Lemon
2019-11-14 21:27   ` Jesper Dangaard Brouer [this message]
2019-11-14 16:37 ` [net-next PATCH v2 2/2] page_pool: remove hold/release count from tracepoints Jonathan Lemon
2019-11-14 20:53   ` kbuild test robot
2019-11-14 21:07   ` Jesper Dangaard Brouer
2019-11-14 21:56     ` Jonathan Lemon

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=20191114222753.03e50613@carbon \
    --to=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jonathan.lemon@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /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).