public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: Martin KaFai Lau <kafai@fb•com>, netdev@vger•kernel.org
Cc: Alexei Starovoitov <ast@fb•com>, kernel-team@fb•com
Subject: Re: [PATCH net-next 2/3] bpf: Inline LRU map lookup
Date: Fri, 01 Sep 2017 11:18:28 +0200	[thread overview]
Message-ID: <59A925E4.6060802@iogearbox.net> (raw)
In-Reply-To: <20170901062713.1842249-3-kafai@fb.com>

On 09/01/2017 08:27 AM, Martin KaFai Lau wrote:
> Inline the lru map lookup to save the cost in making calls to
> bpf_map_lookup_elem() and htab_lru_map_lookup_elem().
>
> Different LRU hash size is tested.  The benefit diminishes when
> the cache miss starts to dominate in the bigger LRU hash.
> Considering the change is simple, it is still worth to optimize.
>
> First column: Size of the LRU hash
> Second column: Number of lookups/s
>
> Before:
>> for i in $(seq 9 20); do echo "$((2**i+1)): $(./map_perf_test 1024 1 $((2**i+1)) 10000000 | awk '{print $3}')"; done
> 513: 1132020
> 1025: 1056826
> 2049: 1007024
> 4097: 853298
> 8193: 742723
> 16385: 712600
> 32769: 688142
> 65537: 677028
> 131073: 619437
> 262145: 498770
> 524289: 316695
> 1048577: 260038
>
> After:
>> for i in $(seq 9 20); do echo "$((2**i+1)): $(./map_perf_test 1024 1 $((2**i+1)) 10000000 | awk '{print $3}')"; done
> 513: 1221851
> 1025: 1144695
> 2049: 1049902
> 4097: 884460
> 8193: 773731
> 16385: 729673
> 32769: 721989
> 65537: 715530
> 131073: 671665
> 262145: 516987
> 524289: 321125
> 1048577: 260048
>
> Signed-off-by: Martin KaFai Lau <kafai@fb•com>

Acked-by: Daniel Borkmann <daniel@iogearbox•net>

  reply	other threads:[~2017-09-01  9:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  6:27 [PATCH net-next 0/3] bpf: Improve LRU map lookup performance Martin KaFai Lau
2017-09-01  6:27 ` [PATCH net-next 1/3] bpf: Add lru_hash_lookup performance test Martin KaFai Lau
2017-09-01  9:12   ` Daniel Borkmann
2017-09-01 14:22   ` Alexei Starovoitov
2017-09-01  6:27 ` [PATCH net-next 2/3] bpf: Inline LRU map lookup Martin KaFai Lau
2017-09-01  9:18   ` Daniel Borkmann [this message]
2017-09-01 14:22   ` Alexei Starovoitov
2017-09-01  6:27 ` [PATCH net-next 3/3] bpf: Only set node->ref = 1 if it has not been set Martin KaFai Lau
2017-09-01  9:28   ` Daniel Borkmann
2017-09-01 14:22   ` Alexei Starovoitov
2017-09-01 16:57 ` [PATCH net-next 0/3] bpf: Improve LRU map lookup performance David Miller

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=59A925E4.6060802@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=ast@fb$(echo .)com \
    --cc=kafai@fb$(echo .)com \
    --cc=kernel-team@fb$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox