Bug 311341 - Incorrect CPU topology parsing
Summary: Incorrect CPU topology parsing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: irqbalance
Version: 5.0
Hardware: All
OS: Linux
low
low
Target Milestone: ---
: ---
Assignee: Neil Horman
QA Contact:
URL:
Whiteboard:
Depends On: 301821
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-28 16:59 UTC by Neil Horman
Modified: 2008-05-21 17:21 UTC (History)
0 users

Fixed In Version: RHBA-2008-0419
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-05-21 17:21:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2008:0419 0 normal SHIPPED_LIVE irqbalance bug fix update and enhancement update 2008-05-19 22:32:06 UTC

Description Neil Horman 2007-09-28 16:59:19 UTC
+++ This bug was initially created as a clone of Bug #301821 +++

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.

-- Additional comment from drepper on 2007-09-22 18:20 EST --
Created an attachment (id=203251)
Patch to avoid unnecessary lookups and small optimizations


-- Additional comment from nhorman on 2007-09-26 15:58 EST --
Thanks Uli, this all looks good to me.  I'll get this to upstream, F7/8 amd RHEL

Comment 1 RHEL Program Management 2007-10-19 20:25:33 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 2 Neil Horman 2007-10-22 20:00:16 UTC
fixed in 0.55-7

Comment 7 errata-xmlrpc 2008-05-21 17:21:20 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0419.html



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