[Pkg-sysvinit-devel] Bug#775912: update-rc.d is slow due to useless fadvise call
Bolesław Tokarski
btokarski at opera.com
Wed Jan 21 13:08:01 UTC 2015
Package: insserv
Version: 1.14.0-5
When update-rc.d is invoked (be it as part of some service installation or
manually), on some machines it takes much more time than anticipated. Example:
# time update-rc.d apache2 defaults
...
real 5m23.611s
user 0m0.092s
sys 0m0.088s
Running an strace -f on the update-rc.d process showed that the biggest
slowdowns are during fadvise64 WILLNEED system call. This system call is
supposed to be asynchronous, should let the system know that it can prefetch
the scripts, and return immediately.
Unfortunately, this is not the case:
https://groups.google.com/forum/#!topic/fa.linux.kernel/6jyLWFKQqQ8
Below is the patch that solves the issue. On machines with 5min+ prior run, it
now takes 0.1s. Other machines did not incur any change in time this execution
took. I have tested and confirmed this on both Squeeze and Wheezy. I have a
Squeeze patch available too, if anyone's interested, though that's just
cosmetics.
Best regards,
Bolesław Tokarski
--- insserv-1.14.0.orig/insserv.c
+++ insserv-1.14.0/insserv.c
@@ -1823,7 +1823,7 @@ static void scan_script_locations(const
continue;
}
- lsb = scan_script_defaults(dfd, d->d_name, override_path, &name,
true, ignore);
+ lsb = scan_script_defaults(dfd, d->d_name, override_path, &name,
false, ignore);
if (!name) {
warn("warning: script is corrupt or invalid: %s/%s%s\n", path,
rcd, d->d_name);
continue;
@@ -2627,7 +2627,7 @@ int main (int argc, char *argv[])
const char *const name = argv[c];
service_t * first = (service_t*)0;
char * provides, * begin, * token;
- const uchar lsb = scan_script_defaults(dfd, name, override_path,
(char**)0, true, ignore);
+ const uchar lsb = scan_script_defaults(dfd, name, override_path,
(char**)0, false, ignore);
if ((lsb & FOUND_LSB_HEADER) == 0) {
if ((lsb & (FOUND_LSB_DEFAULT|FOUND_LSB_OVERRIDE)) == 0)
More information about the Pkg-sysvinit-devel
mailing list