Bug 301821 - Incorrect CPU topology parsing
Summary: Incorrect CPU topology parsing
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: irqbalance
Version: 8
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Neil Horman
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: bzcl34nup
Depends On:
Blocks: 311341
TreeView+ depends on / blocked
 
Reported: 2007-09-22 22:20 UTC by Ulrich Drepper
Modified: 2008-06-27 04:05 UTC (History)
1 user (show)

Fixed In Version: 0.55-9.fc9
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-06-27 04:05:11 UTC
Type: ---


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

Description Ulrich Drepper 2007-09-22 22:20:42 UTC
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

  /sys/devices/system/cpu/cpuidle/online

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
available.

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):
irqbalance-0.55-4.fc8.x86_64

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
3.
  
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 22:20:42 UTC
Created attachment 203251 [details]
Patch to avoid unnecessary lookups and small optimizations

Comment 2 Neil Horman 2007-09-26 19:58:29 UTC
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 13:53:45 UTC
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
rawhide.
(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:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

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 04:05:11 UTC
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.