lkml.org 
[lkml]   [2013]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next] fix unsafe set_memory_rw from softirq
From
Date
On Wed, 2013-10-02 at 21:53 -0700, Eric Dumazet wrote:
> On Wed, 2013-10-02 at 21:44 -0700, Alexei Starovoitov wrote:
>
> > I think ifdef config_x86 is a bit ugly inside struct sk_filter, but
> > don't mind whichever way.
>
> Its not fair to make sk_filter bigger, because it means that simple (non
> JIT) filter might need an extra cache line.
>
> You could presumably use the following layout instead :
>
> struct sk_filter
> {
> atomic_t refcnt;
> struct rcu_head rcu;
> struct work_struct work;
>
> unsigned int len ____cacheline_aligned; /* Number of filter blocks */
> unsigned int (*bpf_func)(const struct sk_buff *skb,
> const struct sock_filter *filter);
> struct sock_filter insns[0];
> };

And since @len is not used by sk_run_filter() use :

struct sk_filter {
atomic_t refcnt;
int len; /* number of filter blocks */
struct rcu_head rcu;
struct work_struct work;

unsigned int (*bpf_func)(const struct sk_buff *skb,
const struct sock_filter *filter) ____cacheline_aligned;
struct sock_filter insns[0];
};





\
 
 \ /
  Last update: 2013-10-03 07:41    [W:0.036 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site