Re: [PATCH bpf-next v5 1/7] bpf, sockmap: add BPF_F_PERMANENT flag for skmsg redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 27, 2023 at 05:30 PM +08, Liu Jian wrote:
> If the sockmap msg redirection function is used only to forward packets
> and no other operation, the execution result of the BPF_SK_MSG_VERDICT
> program is the same each time. In this case, the BPF program only needs to
> be run once. Add BPF_F_PERMANENT flag to bpf_msg_redirect_map() and
> bpf_msg_redirect_hash() to implement this ability.
>
> Then we can enable this function in the bpf program as follows:
> bpf_msg_redirect_hash(xx, xx, xx, BPF_F_INGRESS | BPF_F_PERMANENT);
>
> Test results using netperf  TCP_STREAM mode:
> for i in 1 64 128 512 1k 2k 32k 64k 100k 500k 1m;then
> netperf -T 1,2 -t TCP_STREAM -H 127.0.0.1 -l 20 -- -m $i -s 100m,100m -S 100m,100m
> done
>
> before:
> 3.84 246.52 496.89 1885.03 3415.29 6375.03 40749.09 48764.40 51611.34 55678.26 55992.78
> after:
> 4.43 279.20 555.82 2080.79 3870.70 7105.44 41836.41 49709.75 51861.56 55211.00 54566.85
>
> Signed-off-by: Liu Jian <liujian56@xxxxxxxxxx>
> ---

I adapted a scripted benchmark for sk_msg redirect I had written
recently [1] to double check these numbers.

Looks good. The boost is reproducible. Sample test run captured at [2].

  *** netns-to-netns TCP latency test ***
  
  sockperf: Summary: Message Rate is 87638 [msg/sec]
  sockperf: Summary: BandWidth is 123.027 MBps (984.216 Mbps)
  
  *** netns-to-netns TCP latency test WITH sockmap bypass ***
  
  sockperf: Summary: Message Rate is 135718 [msg/sec]
  sockperf: Summary: BandWidth is 190.522 MBps (1524.177 Mbps)
  
  *** netns-to-netns TCP latency test WITH sockmap bypass + F_PERMANENT ***
  
  sockperf: Summary: Message Rate is 148700 [msg/sec]
  sockperf: Summary: BandWidth is 208.746 MBps (1669.971 Mbps)

And, as expected, I'm seeing just a different prog run count when using
F_PERMANENT after the test:

  175: sk_msg  name sk_msg_prog  tag 7c26e0d6e8e92a36  gpl run_time_ns 245761059 run_cnt 4071588
          loaded_at 2023-10-13T14:27:28+0200  uid 0
          xlated 80B  jited 62B  memlock 4096B  map_ids 88,90
          btf_id 173
  177: sk_msg  name sk_msg_prog_once  tag e460e6fffdc8ff8a  gpl run_time_ns 1441 run_cnt 1
          loaded_at 2023-10-13T14:27:28+0200  uid 0
          xlated 80B  jited 62B  memlock 4096B  map_ids 88,90
          btf_id 173

Feel free to add my:

Tested-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>

[1]
https://github.com/jsitnicki/srecon-2023-sockmap/blob/test-f_permanent/examples/redir-bypass/test_redir_bypass.sh
[2] https://github.com/jsitnicki/srecon-2023-sockmap/blob/test-f_permanent/examples/redir-bypass/example_redir_bypass.txt




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux