Ubuntu

sreadahead uses 100 % of the CPU in Karmic

Reported by François Blondel on 2009-08-29
54
This bug affects 7 people
Affects Status Importance Assigned to Milestone
sreadahead
Unknown
Unknown
sreadahead (Ubuntu)
Medium
Scott James Remnant (Canonical)
Karmic
Medium
Scott James Remnant (Canonical)

Bug Description

Binary package hint: sreadahead

Hi,
Sreadahead uses 100 % of the CPU in Karmic. I haven't any SSD disk, and I use ext4.
Is this package installed by default ? Or did I installed it myselft by error ?
When I try to kill it with "Moniteur système 2.27.4" (french), this monitor crash.
What should I join to help ? dmesg ? ls /dev ?
Thanks

Virtex (c-launchpad-virtex-org) wrote :

I can confirm this bug as I've seen the same behavior. After a fresh boot, when I log in my CPU is running at 100% and the culprit is sreadahead. sreadahead then exits after a minute or so. If you want, you can disable sreadahead by editing the file at /etc/init/sreadahead.conf and commenting out the line that reads:

exec /sbin/sreadahead -t 0

I did this on my Thinkpad R61 (with a spinning hard drive) and my boot time dropped from 61 seconds to 49 seconds.

This is quite normal, it takes a few minutes after the first boot to generate the lists - it's operating as a "very low priority" so shouldn't affect system performance.

If you don't let it finish, it will be slow every time you boot ;-)

Changed in sreadahead (Ubuntu):
status: New → Won't Fix
max (mikhmv) wrote :

I have never interrupt it but after 27 reboots. it wasn't improved.......

Simon Steinbeiß (ochosi) wrote :

i can confirm this annoying behaviour in karmic64bit.
for some reason sreadahead keeps popping up after every reboot with 100%cpu for 10+ seconds. quite a nuisance.

(and yes, this wasn't the case before readahead was replaced by sreadahead)

MichaelRobbert (mrobbert-gmail) wrote :

I am seeing this on every reboot, not just the first. I just rebooted twice in a row without doing any updates. The system had been running smoothly overnight before the first reboot, then I let sreadahead finish before rebooting again and it started up again. If this is considered normal behavior then let us know and/or close the ticket, otherwise this looks like a bug that should be fixed.

Steve Dodier-Lazaro (sidi) wrote :

Scott, is the intented behaviour of sreadahead to run only once, or after each reboot ? If it is meant to run only once as you said, then there definately is a problem, because it keeps running after the first one.

On Thu, 2009-09-17 at 15:25 +0000, Steve Dodier wrote:

> Scott, is the intented behaviour of sreadahead to run only once, or
> after each reboot ? If it is meant to run only once as you said, then
> there definately is a problem, because it keeps running after the first
> one.
>
It will usually profile on any reboot where you've done package installs
or upgrades that touch /etc/init or /etc/init.d

Scott
--
Scott James Remnant
<email address hidden>

Anders Kaseorg (anders-kaseorg) wrote :

As it turns out, the 100% CPU time is spent bubble-sorting a list of readahead records. That’s idiotic. The C library comes with a standard qsort() function for a reason. This is easy to fix and we should do so.

Changed in sreadahead (Ubuntu):
assignee: nobody → Anders Kaseorg (anders-kaseorg)
status: Won't Fix → Confirmed
Anders Kaseorg (anders-kaseorg) wrote :
Changed in sreadahead (Ubuntu):
status: Confirmed → In Progress

On Sun, 2009-09-20 at 17:52 +0000, Anders Kaseorg wrote:

> As it turns out, the 100% CPU time is spent bubble-sorting a list of
> readahead records. That’s idiotic. The C library comes with a standard
> qsort() function for a reason. This is easy to fix and we should do so.
>
Right, I'd looked into this before and switched to qsort() but then
broke other things.

Hadn't had a change to follow-up further.

Thanks for investigating and doing the patch, I'll certainly apply this
one! Good work!

Scott
--
Scott James Remnant
<email address hidden>

Changed in sreadahead (Ubuntu Karmic):
importance: Undecided → Medium
tags: added: ubuntu-boot
Changed in sreadahead (Ubuntu Karmic):
assignee: Anders Kaseorg (anders-kaseorg) → Scott James Remnant (scott)
Changed in sreadahead (Ubuntu Karmic):
milestone: none → ubuntu-9.10

I have uploaded the fix for this bug, however due to the freeze it may take a little while to show up, so I've also uploaded it to the ubuntu-boot PPA. Please test.

Changed in sreadahead (Ubuntu Karmic):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sreadahead - 1.0-4

---------------
sreadahead (1.0-4) karmic; urgency=low

  * Replace custom bubble sort with qsort(), to avoid using 100% CPU
    for a long time after boot. LP: #421116, #434116.

 -- Anders Kaseorg <email address hidden> Sun, 20 Sep 2009 13:31:45 -0400

Changed in sreadahead (Ubuntu Karmic):
status: Fix Committed → Fix Released

This fix appears to have corrected the problem, at least for me. I no longer see the CPU at 100% when I log in after a major software upgrade.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.