From 8d75d794ea505003fddea8e757d43976db8d6861 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 27 Nov 2014 13:20:24 +0100 Subject: libbb: use sendfile() to copy data between file descriptors Busybox already uses sendfile in httpd. This patch proposes to use it globally to copy data between file descriptors. It speeds up the copying on slow systems a lot - below are the times needed to copy a 450Mb file with and without this option enabled on a BeagleBone Black: sendfile: user 0m0.000s sys 0m8.170s read/write 4k: user 0m0.470s sys 0m16.300s function old new delta bb_full_fd_action 394 474 +80 Signed-off-by: Bartosz Golaszewski Signed-off-by: Denys Vlasenko --- Config.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Config.in') diff --git a/Config.in b/Config.in index b83beb52d..285fe0a19 100644 --- a/Config.in +++ b/Config.in @@ -264,6 +264,18 @@ config PAM Use PAM in some busybox applets (currently login and httpd) instead of direct access to password database. +config FEATURE_USE_SENDFILE + bool "Use sendfile system call" + default y + help + When enabled, busybox will use the kernel sendfile() function + instead of read/write loops to copy data between file descriptors + (for example, cp command does this a lot). + If sendfile() doesn't work, copying code falls back to read/write + loop. sendfile() was originally implemented for faster I/O + from files to sockets, but since Linux 2.6.33 it was extended + to work for many more file types. + config LONG_OPTS bool "Support for --long-options" default y -- cgit v1.2.3