[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#426165: apt: Could use a blocking fd to read from the pipe from dpkg



Package: apt
Version: 0.6.46.4-0.1
Severity: wishlist

Playing around with powertop, I noticed a huge amount of wake-ups while
doing some massive apt-get install. Almost 1000 wake-ups reported by
powertop.

These are due to usleep(1000) in apt-pkg/deb/dpkgpm.cc. The thing is
that apt sets the pipe from dpkg as non-blocking, and doesn't wait on
read()s, thus running into the loop and through the usleep().

This is useless and adds extra CPU wake-ups where there is no need for
it.

Simply commenting the fcntl(_dpkgin, F_SETFL, O_NONBLOCK); line makes
things cleaner, and it even seems that the install goes faster, and the
number of i/o interrupts during install gets higher than when the pipe
was non blocking, which would indicate a better throughput, too.

While this comment is enough to keep the code working while improving
things, the waitpid loop could obviously be improved a bit considering
the fd is blocking.

I can't seem to find a reason why the dpkg process would go zombie in
such case, so I think this should be safe, but you can still prove me
wrong.

Cheers,

Mike



Reply to: