Bug 301821 - Incorrect CPU topology parsing
Incorrect CPU topology parsing
Product: Fedora
Classification: Fedora
Component: irqbalance (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Neil Horman
Fedora Extras Quality Assurance
Depends On:
Blocks: 311341
  Show dependency treegraph
Reported: 2007-09-22 18:20 EDT by Ulrich Drepper
Modified: 2008-06-27 00:05 EDT (History)
1 user (show)

See Also:
Fixed In Version: 0.55-9.fc9
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-06-27 00:05:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to avoid unnecessary lookups and small optimizations (3.82 KB, patch)
2007-09-22 18:20 EDT, Ulrich Drepper
no flags Details | Diff

  None (edit)
Description Ulrich Drepper 2007-09-22 18:20:42 EDT
Description of problem:
irqbalance uses the topology information from /sys/devices/system/cpu.  I
noticed that when reading the hierarchy irqbalance tries to open nonsense files like


This is due to an incomplete check when reading the directory
/sys/devices/system/cpu.  The code only checks for a substring "cpu" to be

Once I fixed that I noticed that irqbalance doesn't access these files after the
startup anymore.  This is probably due to the fact that recognizing "cpuidle" as
a real CPU the CPU count is thrown off.  I haven't investigated this further. 
But this little inefficiency is in fact a real bug.

While I was at it I rewrote a large amount of inefficient code.  openat() saves
creating path strings and reduces the lookup times.  Not creating a new string
for each getline call saves overhead related to memory handling.

Version-Release number of selected component (if applicable):

How reproducible:
always (I guess)

Steps to Reproduce:
1.start irqbalance
2.attach to it using strace or use a systemtap script monitoring open calls
Actual results:
Lots of reloading the /sys/devices/system/cpu/ hierarchy and looking for
/sys/devices/system/cpu/cpuidle/online etc.

Expected results:
Infrequent (none after startup?) parsing of the hierarchy.  Don't look into
/sys/devices/system/cpu/cpuidle/ at all.

Additional info:

This patch should probably also be added to RHEL5 and F7.
Comment 1 Ulrich Drepper 2007-09-22 18:20:42 EDT
Created attachment 203251 [details]
Patch to avoid unnecessary lookups and small optimizations
Comment 2 Neil Horman 2007-09-26 15:58:29 EDT
Thanks Uli, this all looks good to me.  I'll get this to upstream, F7/8 amd RHEL
Comment 3 Bug Zapper 2008-04-04 09:53:45 EDT
Based on the date this bug was created, it appears to have been reported
during the development of Fedora 8. In order to refocus our efforts as
a project we are changing the version of this bug to '8'.

If this bug still exists in rawhide, please change the version back to
(If you're unable to change the bug's version, add a comment to the bug
and someone will change it for you.)

Thanks for your help and we apologize for the interruption.

The process we're following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.
Comment 4 Ulrich Drepper 2008-06-27 00:05:11 EDT
The patch I provided is in F9.  So this bug can be closed.

Note You need to log in before you can comment on or make changes to this bug.