All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: John Fastabend <john.fastabend@gmail.com>,
	xiyou.wangcong@gmail.com, jhs@mojatatu.com,
	netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [RCU PATCH 06/14] net: sched: fw use RCU
Date: Fri, 14 Mar 2014 13:35:34 -0700	[thread overview]
Message-ID: <20140314203534.GF21124@linux.vnet.ibm.com> (raw)
In-Reply-To: <1394826958.9668.4.camel@edumazet-glaptop2.roam.corp.google.com>

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,
> 
> 

  reply	other threads:[~2014-03-14 20:35 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 17:03 [RCU PATCH 00/14] Remove qdisc lock around ingress Qdisc John Fastabend
2014-03-10 17:03 ` [RCU PATCH 01/14] net: qdisc: use rcu prefix and silence sparse warnings John Fastabend
2014-03-10 17:20   ` Eric Dumazet
2014-03-10 17:04 ` [RCU PATCH 02/14] net: rcu-ify tcf_proto John Fastabend
2014-03-10 17:30   ` Eric Dumazet
2014-03-10 17:04 ` [RCU PATCH 03/14] net: sched: cls_basic use RCU John Fastabend
2014-03-10 17:33   ` Eric Dumazet
2014-03-10 17:04 ` [RCU PATCH 04/14] net: sched: cls_cgroup " John Fastabend
2014-03-10 17:36   ` Eric Dumazet
2014-03-10 17:05 ` [RCU PATCH 05/14] net: sched: cls_flow " John Fastabend
2014-03-10 17:38   ` Eric Dumazet
2014-03-10 17:05 ` [RCU PATCH 06/14] net: sched: fw " John Fastabend
2014-03-10 17:41   ` Eric Dumazet
2014-03-12 16:41     ` John Fastabend
2014-03-12 17:01       ` Eric Dumazet
2014-03-13 20:22         ` Paul E. McKenney
2014-03-13 20:56           ` Eric Dumazet
2014-03-13 21:15             ` Paul E. McKenney
2014-03-14  5:43               ` John Fastabend
2014-03-14 13:28                 ` Paul E. McKenney
2014-03-14 13:46                   ` Eric Dumazet
2014-03-14 15:38                     ` Paul E. McKenney
2014-03-14 18:50                       ` Paul E. McKenney
2014-03-14 18:59                         ` Paul E. McKenney
2014-03-14 19:55                           ` Eric Dumazet
2014-03-14 20:35                             ` Paul E. McKenney [this message]
2014-03-16 16:06                             ` [PATCH net-next] net: sched: use no more than one page in struct fw_head Eric Dumazet
2014-03-17 13:51                               ` Thomas Graf
2014-03-17 14:13                                 ` Eric Dumazet
2014-03-17 14:29                                   ` David Laight
2014-03-17 15:16                                     ` Eric Dumazet
2014-03-17 15:30                                       ` Thomas Graf
2014-03-17 15:33                                         ` Eric Dumazet
2014-03-17 15:43                                       ` David Laight
2014-03-17 15:52                                         ` Eric Dumazet
2014-03-17 15:28                                   ` Thomas Graf
2014-03-17 15:50                                     ` Thomas Graf
2014-03-17 16:00                                       ` David Laight
2014-03-17 16:16                                         ` Eric Dumazet
2014-03-18  2:31                               ` David Miller
2014-03-18  3:02                                 ` Eric Dumazet
2014-03-18  3:20                                   ` [PATCH v2 " Eric Dumazet
2014-03-18  9:19                                     ` Thomas Graf
2014-03-18 18:18                                     ` David Miller
2014-03-10 17:06 ` [RCU PATCH 07/14] net: sched: RCU cls_route John Fastabend
2014-03-10 17:45   ` Eric Dumazet
2014-03-10 19:36     ` John Fastabend
2014-03-10 17:06 ` [RCU PATCH 08/14] net: sched: RCU cls_tcindex John Fastabend
2014-03-10 17:07 ` [RCU PATCH 09/14] net: sched: make cls_u32 lockless John Fastabend
2014-03-10 17:58   ` Eric Dumazet
2014-03-10 17:07 ` [RCU PATCH 10/14] net: sched: rcu'ify cls_rsvp John Fastabend
2014-03-10 17:07 ` [RCU PATCH 11/14] net: make cls_bpf rcu safe John Fastabend
2014-03-10 17:08 ` [RCU PATCH 12/14] net: sched: make tc_action safe to walk under RCU John Fastabend
2014-03-10 17:08 ` [RCU PATCH 13/14] net: sched: make bstats per cpu and estimator RCU safe John Fastabend
2014-03-10 18:06   ` Eric Dumazet
2014-03-10 19:36     ` John Fastabend
2014-03-10 17:09 ` [RCU PATCH 14/14] net: sched: drop ingress qdisc lock John Fastabend
2014-03-11 20:36 ` [RCU PATCH 00/14] Remove qdisc lock around ingress Qdisc David Miller
2014-03-11 20:53   ` Eric Dumazet
2014-03-12  6:58 ` Jamal Hadi Salim
2014-03-12 16:45   ` John Fastabend
2014-03-13  8:44     ` Jamal Hadi Salim
2014-03-14  7:28       ` John Fastabend
2014-03-14  7:45         ` Jamal Hadi Salim
2014-03-12 18:25 ` Cong Wang

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=20140314203534.GF21124@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.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.