Subject: Re: [RFC PATCH 10/12] xdp: Add batching support to redirect map

From: Jesper Dangaard Brouer <[email-masked]>
Date: Mon, 10 Jul 2017 19:53:55 +0200

On Fri, 07 Jul 2017 10:37:59 -0700
John Fastabend <[email-masked]> wrote:

> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> index 36dc13de..656e334 100644
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
[...]
>  
> +void __dev_map_insert_ctx(struct bpf_map *map, u32 key)
> +{
> +	struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map);
> +	unsigned long *bitmap = this_cpu_ptr(dtab->flush_needed);
> +
> +	set_bit(key, bitmap);
> +}

I don't like that this adds an atomic op (set_bit) per packet on a fast-path.
It shows up on a perf top #6 with xdp_redirect_map.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer