From: John Fastabend <john.fastabend@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH v2 04/11] ixgbe: Update code to better handle incrementing page count
Date: Fri, 10 Feb 2017 15:04:32 -0800 [thread overview]
Message-ID: <589E4700.8090907@gmail.com> (raw)
In-Reply-To: <20170117163600.5423.48511.stgit@localhost.localdomain>
On 17-01-17 08:36 AM, Alexander Duyck wrote:
> From: Alexander Duyck <alexander.h.duyck@intel.com>
>
> Batch the page count updates instead of doing them one at a time. By doing
> this we can improve the overall performance as the atomic increment
> operations can be expensive due to the fact that on x86 they are locked
> operations which can cause stalls. By doing bulk updates we can
> consolidate the stall which should help to improve the overall receive
> performance.
>
[...]
> struct ixgbe_queue_stats {
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 8ee8fcf0fe21..34a5271a7b35 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -1602,6 +1602,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring,
> bi->dma = dma;
> bi->page = page;
> bi->page_offset = 0;
> + bi->pagecnt_bias = 1;
I'm curious why set pagecnt_bias to '1' here but in the ixgbe_can_reuse_rx_page
path set it to USHRT_MAX? Any reason not to just always use the USHRT_MAX
scheme.
>
> return true;
> }
> @@ -1960,13 +1961,15 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_ring *rx_ring,
> unsigned int last_offset = ixgbe_rx_pg_size(rx_ring) -
> ixgbe_rx_bufsz(rx_ring);
> #endif
> + unsigned int pagecnt_bias = rx_buffer->pagecnt_bias--;
> +
> /* avoid re-using remote pages */
> if (unlikely(ixgbe_page_is_reserved(page)))
> return false;
>
> #if (PAGE_SIZE < 8192)
> /* if we are only owner of page we can reuse it */
> - if (unlikely(page_count(page) != 1))
> + if (unlikely(page_count(page) != pagecnt_bias))
> return false;
>
> /* flip page offset to other buffer */
> @@ -1979,10 +1982,14 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_ring *rx_ring,
> return false;
> #endif
>
> - /* Even if we own the page, we are not allowed to use atomic_set()
> - * This would break get_page_unless_zero() users.
> + /* 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.
> */
> - page_ref_inc(page);
> + if (unlikely(pagecnt_bias == 1)) {
> + page_ref_add(page, USHRT_MAX);
> + rx_buffer->pagecnt_bias = USHRT_MAX;
> + }
>
> return true;
> }
Otherwise patch looks good to me. Although it took me a moment to catch the
ref_add/pagecnt_bias usage here.
Acked-by: John Fastabend <john.r.fastabend@intel.com>
next prev parent reply other threads:[~2017-02-10 23:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 16:35 [Intel-wired-lan] [next PATCH v2 00/11] Add support for writable pages and build_skb Alexander Duyck
2017-01-17 16:35 ` [Intel-wired-lan] [next PATCH v2 01/11] ixgbe: Add function for checking to see if we can reuse page Alexander Duyck
2017-01-31 17:32 ` Bowers, AndrewX
2017-01-17 16:35 ` [Intel-wired-lan] [next PATCH v2 02/11] ixgbe: Only DMA sync frame length Alexander Duyck
2017-01-31 17:33 ` Bowers, AndrewX
2017-01-17 16:35 ` [Intel-wired-lan] [next PATCH v2 03/11] ixgbe: Update driver to make use of DMA attributes in Rx path Alexander Duyck
2017-01-31 17:33 ` Bowers, AndrewX
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 04/11] ixgbe: Update code to better handle incrementing page count Alexander Duyck
2017-01-31 17:34 ` Bowers, AndrewX
2017-02-10 23:04 ` John Fastabend [this message]
2017-02-10 23:15 ` Alexander Duyck
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 05/11] ixgbe: Make use of order 1 pages and 3K buffers independent of FCoE Alexander Duyck
2017-01-31 17:34 ` Bowers, AndrewX
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 06/11] ixgbe: Use length to determine if descriptor is done Alexander Duyck
2017-01-31 17:35 ` Bowers, AndrewX
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 07/11] ixgbe: Break out Rx buffer page management Alexander Duyck
2017-01-31 17:35 ` Bowers, AndrewX
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 08/11] ixgbe: Add support for padding packet Alexander Duyck
2017-01-31 17:35 ` Bowers, AndrewX
2017-01-17 16:37 ` [Intel-wired-lan] [next PATCH v2 09/11] ixgbe: Add private flag to control buffer mode Alexander Duyck
2017-01-31 17:36 ` Bowers, AndrewX
2017-01-17 16:37 ` [Intel-wired-lan] [next PATCH v2 10/11] ixgbe: Add support for build_skb Alexander Duyck
2017-01-31 17:36 ` Bowers, AndrewX
2017-01-17 16:37 ` [Intel-wired-lan] [next PATCH v2 11/11] ixgbe: Don't bother clearing buffer memory for descriptor rings Alexander Duyck
2017-01-31 17:36 ` Bowers, AndrewX
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=589E4700.8090907@gmail.com \
--to=john.fastabend@gmail.com \
--cc=intel-wired-lan@osuosl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.