RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1691824 - Parallelize /usr/lib/rpm/brp-strip-static-archive
Summary: Parallelize /usr/lib/rpm/brp-strip-static-archive
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: rpm
Version: 8.2
Hardware: All
OS: Linux
medium
low
Target Milestone: rc
: 8.0
Assignee: Florian Festi
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-22 15:26 UTC by Denys Vlasenko
Modified: 2023-02-12 23:07 UTC (History)
4 users (show)

Fixed In Version: rpm-4.14.2-33.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:51:12 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-28429 0 None None None 2023-02-12 23:07:09 UTC
Red Hat Product Errata RHEA-2020:1835 0 None None None 2020-04-28 16:51:39 UTC

Description Denys Vlasenko 2019-03-22 15:26:02 UTC
Please backport fix for Fedora bz 1691822.

Copying its description below:

Kernel's rpm build process executes this command at a certain stage:

/usr/lib/rpm/brp-strip-static-archive /usr/bin/strip

which is a shell script.

At this point, kernel build tree has ~60 thousand files. Even though our build machines have at least 6-10 CPUs, the script is written so that it executes "file FILE" for every file, in sequence:

# Strip static libraries.
for f in `find "$RPM_BUILD_ROOT" -type f -a -exec file {} \; | \
        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
        grep 'current ar archive' | \
        sed -n -e 's/^\(.*\):[  ]*current ar archive/\1/p'`; do
        $STRIP -g "$f"
done

This means one fork per file. And totally sequential. For kernel, this takes 2 minutes on a fast x86 machine with 88 CPUs.

Proposed replacement:

# Strip static libraries.
#
# Sometimes this is run on trees with 100 thousand files. Be efficient:
# xargs -r -P$NPROC -n16 file | sed 's/:  */: /'
# is used to
# * xargs: avoid fork overhead per each file
# * -P$NPROC: parallelize
# * -n16: avoid running just a few "file LIST" cmds with huge LISTs
# * sed 's/:  */: /': defeat "file F1 FILE2" columnar formatting:
#   | F1:    type1 <--- extra spaces after colon
#   | FILE2: type2
NPROC=`nproc`
test "$NPROC" || NPROC=1
for f in `find "$RPM_BUILD_ROOT" -type f | \
        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
        xargs -r -P$NPROC -n16 file | sed 's/:  */: /' | \
        grep 'current ar archive' | \
        sed -n -e 's/^\(.*\):[  ]*current ar archive/\1/p'`; do
        $STRIP -g "$f"
done

For kernel build, this reduces time to run this fragment from 2 minutes to 3 seconds on a 88 CPU machine.

Comment 10 Denys Vlasenko 2019-05-03 06:43:04 UTC
Looks good to me!

Comment 19 errata-xmlrpc 2020-04-28 16:51:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:1835


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