This patch introduces busy waiting for pipes similar to network sockets.Hi,
When pipe is full or empty a thread busy waits for some microseconds before
sleeping. This avoids the sleep and wakeup overhead and improves
performance in case wakeup happens very fast. It uses new fields in
pipe_inode_info to decide how much to spin and if data has been written or
read during spin. As different workloads on different systems can have
different optimum spin time, it is configurable via a tunable that can be
set via /proc. The default value is 0 which indicates no spin.
Following are the hackbench process run times using pipe for different
sized systems with baseline and suitable spin time.
Hackbench on 2 socket, 36 core and 72 threads Intel x86 machine
(lower is better):
groups baseline patch(spin=10us)
1 0.603 0.614 (-1.82%)
2 0.673 0.527 (21.7%)
4 0.765 0.638 (16.6%)
8 1.935 1.114 (42.43%)
16 7.314 2.007 (72.56%)
32 6.215 3.585 (42.32%)
Hackbench on 1 socket, 16 core and 32 threads Intel x86 VM
(lower is better):
groups baseline patch(spin=10us)
1 1.314 0.747 (43.15%)
2 1.454 0.754 (48.14%)
4 3.409 1.343 (60.6%)
8 6.879 2.559 (62.8%)
16 9.82 4.951 (49.58%)
Hackbench on 1 socket, 4 core and 8 threads Intel x86 VM
(lower is better):
groups baseline patch(spin=5us)
1 2.827 1.455 (48.53%)
2 6.201 2.805 (54.77%)
4 9.514 5.008 (47.36%)
8 14.571 8.422 (42.2%)
Hackbench on 1 socket, 1 core and 2 threads Intel x86 VM
(lower is better):
groups baseline patch(spin=5us)
1 3.365 2.948 (12.39%)
2 6.82 6.535 (4.18%)
4 13.18 13.025 (1.18%)
subhra mazumdar (2):
pipe: introduce busy wait for pipe
pipe: use pipe busy wait
fs/pipe.c | 58 +++++++++++++++++++++++++++++++++++++++++++++--
include/linux/pipe_fs_i.h | 20 ++++++++++++++++
kernel/sysctl.c | 7 ++++++
3 files changed, 83 insertions(+), 2 deletions(-)