lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140314203534.GF21124@linux.vnet.ibm.com>
Date:	Fri, 14 Mar 2014 13:35:34 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	John Fastabend <john.fastabend@...il.com>,
	xiyou.wangcong@...il.com, jhs@...atatu.com, netdev@...r.kernel.org,
	davem@...emloft.net
Subject: Re: [RCU PATCH 06/14] net: sched: fw use RCU

On Fri, Mar 14, 2014 at 12:55:58PM -0700, Eric Dumazet wrote:
> On Fri, 2014-03-14 at 11:59 -0700, Paul E. McKenney wrote:
> 
> > Or I could find some other large area of memory that never contains
> > functions, for example, the beginning of data or bss (if we still have
> > those).  Then check for a range rather than a cutoff.
> 
> For the particular cls_fw.c case I think we should just use one page.
> 
> Not that I think extending kfree_rcu() range is not useful, do not be
> fooled !
> 
> This fw_hash() is really complex, gcc can use a reciprocal divide and it
> will be even faster...
> 
> If John adds a rcu_head, it will simply remove two slots in the hash
> table, big deal....

OK, dropping my current patch, and adding this back to the todo list.

I am sure I will kick myself when the trivial solution makes itself
apparent...

							Thanx, Paul

> diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
> index a366537f82c6..6b68f2da6860 100644
> --- a/net/sched/cls_fw.c
> +++ b/net/sched/cls_fw.c
> @@ -29,11 +29,12 @@
>  #include <net/act_api.h>
>  #include <net/pkt_cls.h>
> 
> -#define HTSIZE (PAGE_SIZE/sizeof(struct fw_filter *))
> +
> +#define HTSIZE ((PAGE_SIZE - sizeof(u32)) / sizeof(struct fw_filter *))
> 
>  struct fw_head {
> -	struct fw_filter *ht[HTSIZE];
>  	u32 mask;
> +	struct fw_filter *ht[HTSIZE];
>  };
> 
>  struct fw_filter {
> @@ -48,28 +49,7 @@ struct fw_filter {
> 
>  static inline int fw_hash(u32 handle)
>  {
> -	if (HTSIZE == 4096)
> -		return ((handle >> 24) & 0xFFF) ^
> -		       ((handle >> 12) & 0xFFF) ^
> -		       (handle & 0xFFF);
> -	else if (HTSIZE == 2048)
> -		return ((handle >> 22) & 0x7FF) ^
> -		       ((handle >> 11) & 0x7FF) ^
> -		       (handle & 0x7FF);
> -	else if (HTSIZE == 1024)
> -		return ((handle >> 20) & 0x3FF) ^
> -		       ((handle >> 10) & 0x3FF) ^
> -		       (handle & 0x3FF);
> -	else if (HTSIZE == 512)
> -		return (handle >> 27) ^
> -		       ((handle >> 18) & 0x1FF) ^
> -		       ((handle >> 9) & 0x1FF) ^
> -		       (handle & 0x1FF);
> -	else if (HTSIZE == 256) {
> -		u8 *t = (u8 *) &handle;
> -		return t[0] ^ t[1] ^ t[2] ^ t[3];
> -	} else
> -		return handle & (HTSIZE - 1);
> +	return handle % HTSIZE;
>  }
> 
>  static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp,
> 
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ