[Pkg-sysvinit-devel] Bug#775912: Bug#775912: update-rc.d is slow due to useless fadvise call

Henrique de Moraes Holschuh hmh at debian.org
Wed Jan 21 13:58:31 UTC 2015


On Wed, 21 Jan 2015, Bolesław Tokarski wrote:
> 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

With which kernel and arch have you run your tests?

And how did a small read-ahead request ended up taking five *minutes* on
your system?  Is it that badly IO-starved?

> 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 

Because it was never supposed to take 5 minutes in the first place...

> --- 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)

I don't mind the patch, but it would be nice to understand the problem
better, first.  Maybe we can disable the fadvise selectively...

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh



More information about the Pkg-sysvinit-devel mailing list