Bug 311341 - Incorrect CPU topology parsing
Incorrect CPU topology parsing
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: irqbalance (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Neil Horman
Depends On: 301821
  Show dependency treegraph
Reported: 2007-09-28 12:59 EDT by Neil Horman
Modified: 2008-05-21 13:21 EDT (History)
0 users

See Also:
Fixed In Version: RHBA-2008-0419
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-05-21 13:21:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Neil Horman 2007-09-28 12:59:19 EDT
+++ 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


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.

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

-- Additional comment from nhorman@redhat.com 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 Product and Program Management 2007-10-19 16:25:33 EDT
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
Comment 2 Neil Horman 2007-10-22 16:00:16 EDT
fixed in 0.55-7
Comment 7 errata-xmlrpc 2008-05-21 13:21:20 EDT
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.


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