Skip to contentSkip to conversation

question about the performance of 'btrfs send'

DISCUSSION Wang Yugui 2 participants 2 messages Oct 15, 2022 – Oct 17, 2022 Btrfs file system

lore
Share & tools
lore

Wang Yugui

author
#0 lore raw

Hi,

a question about the performance of 'btrfs send'.

The output speed of 'btrfs send' is about 700MiB/s in the 3 cases.
1) kernel 5.15.73 + 'btrfs send --proto 1'
2) kernel: 6.0.1(with btrfs-devel misc-6.1) + 'btrfs send --proto 1'
3) kernel: 6.0.1(with btrfs-devel misc-6.1) + 'btrfs send --proto 2'
btrfs-progs: 6.0

the outut of 'perf report':
Overhead Command Shared Object Symbol

*1  40.63%  btrfs    [kernel.kallsyms]  [k] __crc32c_le
*2   9.97%  btrfs    [kernel.kallsyms]  [k] memcpy_erms
*3   9.25%  btrfs    [kernel.kallsyms]  [k] send_extent_data
*4   5.40%  btrfs    [kernel.kallsyms]  [k] asm_exc_nmi
*5   2.73%  btrfs    [kernel.kallsyms]  [k] __alloc_pages
   1.14%  btrfs    [kernel.kallsyms]  [k] __rmqueue_pcplist
   0.92%  btrfs    [kernel.kallsyms]  [k] bad_range
   0.88%  btrfs    [kernel.kallsyms]  [k] get_page_from_freelist

What I expected:
the above *1) __crc32c_le take >60%, and the outut speed > 1GiB/s. The *1) __crc32c_le is necessary operation, and the speed seems OK. 2GB/s * 40% = 800MiB/s, it is close to 700MiB/s.

Question:
The above *3) is difficult to understand. Any advice?

Best Regards
Wang Yugui ([email protected])
2022/10/15

#1 lore raw
Quoted 21 lines · Wang Yugui

Hi,

a question about the performance of 'btrfs send'.

The output speed of 'btrfs send' is about 700MiB/s in the 3 cases.
1) kernel 5.15.73 + 'btrfs send --proto 1'
2) kernel: 6.0.1(with btrfs-devel misc-6.1) + 'btrfs send --proto 1'
3) kernel: 6.0.1(with btrfs-devel misc-6.1) + 'btrfs send --proto 2'
btrfs-progs: 6.0

the outut of 'perf report':
Overhead Command Shared Object Symbol

*1  40.63%  btrfs    [kernel.kallsyms]  [k] __crc32c_le
*2   9.97%  btrfs    [kernel.kallsyms]  [k] memcpy_erms
*3   9.25%  btrfs    [kernel.kallsyms]  [k] send_extent_data
*4   5.40%  btrfs    [kernel.kallsyms]  [k] asm_exc_nmi
*5   2.73%  btrfs    [kernel.kallsyms]  [k] __alloc_pages
   1.14%  btrfs    [kernel.kallsyms]  [k] __rmqueue_pcplist
   0.92%  btrfs    [kernel.kallsyms]  [k] bad_range
   0.88%  btrfs    [kernel.kallsyms]  [k] get_page_from_freelist
Quoted 7 lines

What I expected:
the above *1) __crc32c_le take >60%, and the outut speed > 1GiB/s. The *1) __crc32c_le is necessary operation, and the speed seems OK. 2GB/s * 40% = 800MiB/s, it is close to 700MiB/s.

Question:
The above *3) is difficult to understand. Any advice?

The perf report does not include IO, right? It's only CPU time spent. That it's accounted only for send_extent_data would also mean there's some function inlining involved so it does not point exactly where the time is spent. I'd say it's the main loop around send_write that emits the commands and works with memory data.

What could be suboptimal is the call get_cur_path in send_write that rebuilds the path each time even though it's for the same file.