From: Jesper Dangaard Brouer <brouer@redhat.com>
To: netdev@vger.kernel.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Jesper Dangaard Brouer <brouer@redhat.com>,
aravinda@linux.vnet.ibm.com, Christoph Lameter <cl@linux.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
iamjoonsoo.kim@lge.com
Subject: [RFC PATCH 3/3] ixgbe: bulk free SKBs during TX completion cleanup cycle
Date: Fri, 04 Sep 2015 19:01:21 +0200 [thread overview]
Message-ID: <20150904170117.4312.97676.stgit@devil> (raw)
In-Reply-To: <20150904165944.4312.32435.stgit@devil>
First user of the SKB bulk free API (namely kfree_skb_bulk() via
waitlist helper add-and-flush API).
There is an opportunity to bulk free SKBs during reclaiming of
resources after DMA transmit completes in ixgbe_clean_tx_irq. Thus,
bulk freeing at this point does not introduce any added latency.
Choosing bulk size 32 even-though budget usually is 64, due (1) to
limit the stack usage and (2) as SLAB behind SKBs have 32 objects per
slab.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 463ff47200f1..d35d6b47bae2 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1075,6 +1075,7 @@ static void ixgbe_tx_timeout_reset(struct ixgbe_adapter *adapter)
* @q_vector: structure containing interrupt and ring information
* @tx_ring: tx ring to clean
**/
+#define BULK_FREE_SIZE 32
static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
struct ixgbe_ring *tx_ring)
{
@@ -1084,6 +1085,11 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
unsigned int total_bytes = 0, total_packets = 0;
unsigned int budget = q_vector->tx.work_limit;
unsigned int i = tx_ring->next_to_clean;
+ struct sk_buff *skbs[BULK_FREE_SIZE];
+ struct dev_free_waitlist wl;
+
+ wl.skb_cnt = 0;
+ wl.skbs = skbs;
if (test_bit(__IXGBE_DOWN, &adapter->state))
return true;
@@ -1113,8 +1119,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
total_bytes += tx_buffer->bytecount;
total_packets += tx_buffer->gso_segs;
- /* free the skb */
- dev_consume_skb_any(tx_buffer->skb);
+ /* delay skb free and bulk free later */
+ dev_free_waitlist_add(&wl, tx_buffer->skb, BULK_FREE_SIZE);
/* unmap skb header data */
dma_unmap_single(tx_ring->dev,
@@ -1164,6 +1170,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
budget--;
} while (likely(budget));
+ dev_free_waitlist_flush(&wl); /* free remaining SKBs on waitlist */
+
i += tx_ring->count;
tx_ring->next_to_clean = i;
u64_stats_update_begin(&tx_ring->syncp);
@@ -1224,6 +1232,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
return !!budget;
}
+#undef BULK_FREE_SIZE
#ifdef CONFIG_IXGBE_DCA
static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter,
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-09-04 17:01 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 0:58 [PATCH V2 0/3] slub: introducing detached freelist Jesper Dangaard Brouer
2015-08-24 0:58 ` Jesper Dangaard Brouer
2015-08-24 0:58 ` [PATCH V2 1/3] slub: extend slowpath __slab_free() to handle bulk free Jesper Dangaard Brouer
2015-08-24 0:58 ` Jesper Dangaard Brouer
2015-08-24 0:59 ` [PATCH V2 2/3] slub: optimize bulk slowpath free by detached freelist Jesper Dangaard Brouer
2015-08-24 0:59 ` Jesper Dangaard Brouer
2015-08-24 0:59 ` [PATCH V2 3/3] slub: build detached freelist with look-ahead Jesper Dangaard Brouer
2015-08-24 0:59 ` Jesper Dangaard Brouer
2015-09-04 17:00 ` [RFC PATCH 0/3] Network stack, first user of SLAB/kmem_cache bulk free API Jesper Dangaard Brouer
2015-09-04 17:00 ` Jesper Dangaard Brouer
2015-09-04 17:00 ` [RFC PATCH 1/3] net: introduce kfree_skb_bulk() user of kmem_cache_free_bulk() Jesper Dangaard Brouer
2015-09-04 18:47 ` Tom Herbert
2015-09-07 8:41 ` Jesper Dangaard Brouer
2015-09-07 8:41 ` Jesper Dangaard Brouer
2015-09-07 16:25 ` Tom Herbert
2015-09-07 20:14 ` Jesper Dangaard Brouer
2015-09-07 20:14 ` Jesper Dangaard Brouer
2015-09-08 21:01 ` David Miller
2015-09-04 17:01 ` [RFC PATCH 2/3] net: NIC helper API for building array of skbs to free Jesper Dangaard Brouer
2015-09-04 17:01 ` Jesper Dangaard Brouer
2015-09-04 17:01 ` Jesper Dangaard Brouer [this message]
2015-09-04 18:09 ` [RFC PATCH 0/3] Network stack, first user of SLAB/kmem_cache bulk free API Alexander Duyck
2015-09-04 18:55 ` Christoph Lameter
2015-09-04 20:39 ` Alexander Duyck
2015-09-04 23:45 ` Christoph Lameter
2015-09-05 11:18 ` Jesper Dangaard Brouer
2015-09-08 17:32 ` Christoph Lameter
2015-09-08 17:32 ` Christoph Lameter
2015-09-09 12:59 ` Jesper Dangaard Brouer
2015-09-09 14:08 ` Christoph Lameter
2015-09-09 14:08 ` Christoph Lameter
2015-09-07 8:16 ` Jesper Dangaard Brouer
2015-09-07 21:23 ` Alexander Duyck
2015-09-07 21:23 ` Alexander Duyck
2015-09-16 10:02 ` Experiences with slub bulk use-case for network stack Jesper Dangaard Brouer
2015-09-16 10:02 ` Jesper Dangaard Brouer
2015-09-16 15:13 ` Christoph Lameter
2015-09-17 20:17 ` Jesper Dangaard Brouer
2015-09-17 23:57 ` Christoph Lameter
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=20150904170117.4312.97676.stgit@devil \
--to=brouer@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aravinda@linux.vnet.ibm.com \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.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 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.