From: Jakub Kicinski <kuba@kernel.org>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
netdev@vger.kernel.org, Alan Brady <alan.brady@intel.com>,
pavan.kumar.linga@intel.com, emil.s.tantilov@intel.com,
jesse.brandeburg@intel.com, sridhar.samudrala@intel.com,
shiraz.saleem@intel.com, sindhu.devale@intel.com,
willemb@google.com, decot@google.com, andrew@lunn.ch,
leon@kernel.org, mst@redhat.com, simon.horman@corigine.com,
shannon.nelson@amd.com, stephen@networkplumber.org,
Joshua Hay <joshua.a.hay@intel.com>,
Madhu Chittim <madhu.chittim@intel.com>,
Phani Burra <phani.r.burra@intel.com>
Subject: Re: [PATCH net-next v2 12/15] idpf: add RX splitq napi poll support
Date: Sat, 17 Jun 2023 00:01:01 -0700 [thread overview]
Message-ID: <20230617000101.191ea52c@kernel.org> (raw)
In-Reply-To: <20230614171428.1504179-13-anthony.l.nguyen@intel.com>
On Wed, 14 Jun 2023 10:14:25 -0700 Tony Nguyen wrote:
> +static bool idpf_rx_can_reuse_page(struct idpf_rx_buf *rx_buf)
> +{
> + unsigned int last_offset = PAGE_SIZE - rx_buf->buf_size;
> + struct idpf_page_info *pinfo;
> + unsigned int pagecnt_bias;
> + struct page *page;
> +
> + pinfo = &rx_buf->page_info[rx_buf->page_indx];
> + pagecnt_bias = pinfo->pagecnt_bias;
> + page = pinfo->page;
> +
> + if (unlikely(!dev_page_is_reusable(page)))
> + return false;
> +
> + if (PAGE_SIZE < 8192) {
> + /* For 2K buffers, we can reuse the page if we are the
> + * owner. For 4K buffers, we can reuse the page if there are
> + * no other others.
> + */
> + if (unlikely((page_count(page) - pagecnt_bias) >
> + pinfo->reuse_bias))
> + return false;
> + } else if (pinfo->page_offset > last_offset) {
> + return false;
> + }
> +
> + /* If we have drained the page fragment pool we need to update
> + * the pagecnt_bias and page count so that we fully restock the
> + * number of references the driver holds.
> + */
> + if (unlikely(pagecnt_bias == 1)) {
> + page_ref_add(page, USHRT_MAX - 1);
> + pinfo->pagecnt_bias = USHRT_MAX;
> + }
> +
> + return true;
> +}
If you want to do local recycling you must use the page pool first,
and then share the analysis of how much and why the recycling helps.
next prev parent reply other threads:[~2023-06-17 7:01 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 17:14 [PATCH net-next v2 00/15][pull request] Introduce Intel IDPF driver Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 01/15] virtchnl: add virtchnl version 2 ops Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 02/15] idpf: add module register and probe functionality Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 03/15] idpf: add controlq init and reset checks Tony Nguyen
2023-06-17 6:42 ` Jakub Kicinski
2023-06-21 19:05 ` Linga, Pavan Kumar
2023-06-21 19:14 ` Jakub Kicinski
2023-06-21 19:43 ` Simon Horman
2023-06-14 17:14 ` [PATCH net-next v2 04/15] idpf: add core init and interrupt request Tony Nguyen
2023-06-17 6:50 ` Jakub Kicinski
2023-06-21 19:07 ` Linga, Pavan Kumar
2023-06-14 17:14 ` [PATCH net-next v2 05/15] idpf: add create vport and netdev configuration Tony Nguyen
2023-06-14 18:21 ` Stephen Hemminger
2023-06-15 0:12 ` Linga, Pavan Kumar
2023-06-14 17:14 ` [PATCH net-next v2 06/15] idpf: continue expanding init task Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 07/15] idpf: configure resources for TX queues Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 08/15] idpf: configure resources for RX queues Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 09/15] idpf: initialize interrupts and enable vport Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 10/15] idpf: add splitq start_xmit Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 11/15] idpf: add TX splitq napi poll support Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 12/15] idpf: add RX " Tony Nguyen
2023-06-17 6:55 ` Jakub Kicinski
2023-06-21 19:07 ` Linga, Pavan Kumar
2023-06-17 7:01 ` Jakub Kicinski [this message]
2023-06-21 19:09 ` Linga, Pavan Kumar
2023-06-21 19:21 ` Jakub Kicinski
2023-06-14 17:14 ` [PATCH net-next v2 13/15] idpf: add singleq start_xmit and napi poll Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 14/15] idpf: add ethtool callbacks Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 15/15] idpf: configure SRIOV and add other ndo_ops Tony Nguyen
-- strict thread matches above, loose matches on Subject: below --
2023-04-11 1:13 [PATCH net-next v2 00/15] Introduce Intel IDPF driver Pavan Kumar Linga
2023-04-11 1:13 ` [PATCH net-next v2 12/15] idpf: add RX splitq napi poll support Pavan Kumar Linga
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=20230617000101.191ea52c@kernel.org \
--to=kuba@kernel.org \
--cc=alan.brady@intel.com \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=decot@google.com \
--cc=edumazet@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=joshua.a.hay@intel.com \
--cc=leon@kernel.org \
--cc=madhu.chittim@intel.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.kumar.linga@intel.com \
--cc=phani.r.burra@intel.com \
--cc=shannon.nelson@amd.com \
--cc=shiraz.saleem@intel.com \
--cc=simon.horman@corigine.com \
--cc=sindhu.devale@intel.com \
--cc=sridhar.samudrala@intel.com \
--cc=stephen@networkplumber.org \
--cc=willemb@google.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).