Patchwork [v2,nf-next] netfilter: conntrack: remove the central spinlock

login
register
mail settings
Submitter Joe Perches
Date May 22, 2013, 9:12 p.m.
Message ID <1369257171.2143.120.camel@joe-AO722>
Download mbox | patch
Permalink /patch/245720/
State Not Applicable
Headers show

Comments

Joe Perches - May 22, 2013, 9:12 p.m.
On Wed, 2013-05-22 at 13:48 -0700, Eric Dumazet wrote:
> On Wed, 2013-05-22 at 13:38 -0700, Joe Perches wrote:
> 
> > u16 for cpu is hardly used at all.
> 
> Its used in network tree.
> 
> The day it has to change, don't worry, I think we'll be able to handle
> it.
> 
> For the meantime, I do not want to add 4 more bytes to conntrack
> structure, its already bloated enough.

I wrote "nice" already, no worries.

btw: netdevice.h could possibly convert xmit_lock_owner
to u16 as well for that same 4 byte savings if the -1
test was converted too.
---
 include/linux/netdevice.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)




--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - May 22, 2013, 9:29 p.m.
From: Joe Perches <joe@perches.com>
Date: Wed, 22 May 2013 14:12:51 -0700

> @@ -528,7 +528,7 @@ struct netdev_queue {
>   * write mostly part
>   */
>  	spinlock_t		_xmit_lock ____cacheline_aligned_in_smp;
> -	int			xmit_lock_owner;
> +	u16			xmit_lock_owner;
>  	/*
>  	 * please use this field instead of dev->trans_start
>  	 */
> @@ -2453,7 +2453,7 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
>  
>  static inline void txq_trans_update(struct netdev_queue *txq)
>  {
> -	if (txq->xmit_lock_owner != -1)
> +	if (txq->xmit_lock_owner != (u16)-1)
>  		txq->trans_start = jiffies;
>  }

Then technically this is an s16, don't use casts to pretend that it
isn't.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - May 22, 2013, 9:34 p.m.
On Wed, 2013-05-22 at 14:12 -0700, Joe Perches wrote:
> On Wed, 2013-05-22 at 13:48 -0700, Eric Dumazet wrote:
> > On Wed, 2013-05-22 at 13:38 -0700, Joe Perches wrote:
> > 
> > > u16 for cpu is hardly used at all.
> > 
> > Its used in network tree.
> > 
> > The day it has to change, don't worry, I think we'll be able to handle
> > it.
> > 
> > For the meantime, I do not want to add 4 more bytes to conntrack
> > structure, its already bloated enough.
> 
> I wrote "nice" already, no worries.
> 
> btw: netdevice.h could possibly convert xmit_lock_owner
> to u16 as well for that same 4 byte savings if the -1
> test was converted too.
> ---
>  include/linux/netdevice.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 60584b1..c38cd29 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -528,7 +528,7 @@ struct netdev_queue {
>   * write mostly part
>   */
>  	spinlock_t		_xmit_lock ____cacheline_aligned_in_smp;
> -	int			xmit_lock_owner;
> +	u16			xmit_lock_owner;
>  	/*

Typical machines have less than 10 structures like this one, there is no
gain trying to save some bytes, and more gain trying to get correct
alignments ;)

While conntracking can easily consume more than 10.000.000 conntracks on
a machine.



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 60584b1..c38cd29 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -528,7 +528,7 @@  struct netdev_queue {
  * write mostly part
  */
 	spinlock_t		_xmit_lock ____cacheline_aligned_in_smp;
-	int			xmit_lock_owner;
+	u16			xmit_lock_owner;
 	/*
 	 * please use this field instead of dev->trans_start
 	 */
@@ -2453,7 +2453,7 @@  static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
 
 static inline void txq_trans_update(struct netdev_queue *txq)
 {
-	if (txq->xmit_lock_owner != -1)
+	if (txq->xmit_lock_owner != (u16)-1)
 		txq->trans_start = jiffies;
 }