From: jboero <boeroboy@gmail.com>
To: selinux@vger.kernel.org
Cc: stephen.smalley.work@gmail.com, cgzones@googlemail.com,
Johnny Boero <boeroboy@gmail.com>
Subject: [PATCH v1 2/3] policycoreutils/setfiles: use all CPU cores by default
Date: Tue, 18 Aug 2026 14:23:32 -0500 [thread overview]
Message-ID: <20260818192340.119297-3-boeroboy@gmail.com> (raw)
In-Reply-To: <20260818192340.119297-1-boeroboy@gmail.com>
From: Johnny Boero <boeroboy@gmail.com>
setfiles(8) and restorecon(8) have supported parallel relabeling via -T
since commit 93902fc8b0b0 ("setfiles/restorecon: support parallel
relabeling"), but default to a single thread, so anything that does not
pass -T explicitly relabels on one core.
That is most callers. RPM scriptlets, fixfiles(8) and hand-run
restorecon invocations all use the default, and on a machine with a high
core count the result is a long, almost entirely idle relabel: a package
upgrade on an 88 core system spent hours in restorecon with 87 cores
doing nothing.
Default nthreads to 0, i.e. one thread per available CPU core. The
relabeling is already serialized where it needs to be, and -T 1 remains
available for callers that want the previous behaviour.
Relabeling /usr/share (~588k files, dry run) on an 88 core system:
-T 1 20.43s
-T 0 15.78s
Link: https://github.com/SELinuxProject/selinux/issues/489
Signed-off-by: Johnny Boero <boeroboy@gmail.com>
---
policycoreutils/setfiles/restorecon.8 | 2 +-
policycoreutils/setfiles/setfiles.8 | 2 +-
policycoreutils/setfiles/setfiles.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/policycoreutils/setfiles/restorecon.8 b/policycoreutils/setfiles/restorecon.8
index 443f29ab..8d7b46f0 100644
--- a/policycoreutils/setfiles/restorecon.8
+++ b/policycoreutils/setfiles/restorecon.8
@@ -186,7 +186,7 @@ from crossing file system boundaries.
use up to
.I nthreads
threads. Specify 0 to create as many threads as there are available
-CPU cores; 1 to use only a single thread (default); or any positive
+CPU cores (default); 1 to use only a single thread; or any positive
number to use the given number of threads (if possible).
.TP
.SH "ARGUMENTS"
diff --git a/policycoreutils/setfiles/setfiles.8 b/policycoreutils/setfiles/setfiles.8
index b521df22..53cb97cc 100644
--- a/policycoreutils/setfiles/setfiles.8
+++ b/policycoreutils/setfiles/setfiles.8
@@ -191,7 +191,7 @@ produces input suitable for this mode.
use up to
.I nthreads
threads. Specify 0 to create as many threads as there are available
-CPU cores; 1 to use only a single thread (default); or any positive
+CPU cores (default); 1 to use only a single thread; or any positive
number to use the given number of threads (if possible).
.TP
.B \-A
diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c
index c86cc0c9..4c860755 100644
--- a/policycoreutils/setfiles/setfiles.c
+++ b/policycoreutils/setfiles/setfiles.c
@@ -168,7 +168,7 @@ int main(int argc, char **argv)
const char *input_filename = NULL;
int use_input_file = 0;
char *buf = NULL;
- size_t buf_len = 0, nthreads = 1;
+ size_t buf_len = 0, nthreads = 0;
const char *base;
int errors = 0;
const char *ropts = "ce:f:hijIDlmno:pqrsvFURW0xT:";
--
2.55.0
next prev parent reply other threads:[~2026-08-18 19:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 19:23 [PATCH v1 0/3] setfiles: control relabeling parallelism from the environment jboero
2026-08-18 19:23 ` [PATCH v1 1/3] policycoreutils/setfiles: reject invalid -T arguments jboero
2026-08-18 20:04 ` Stephen Smalley
2026-08-19 16:41 ` James Carter
2026-08-19 16:42 ` John Boero
2026-08-18 19:23 ` jboero [this message]
2026-08-18 20:05 ` [PATCH v1 2/3] policycoreutils/setfiles: use all CPU cores by default Stephen Smalley
2026-08-18 19:23 ` [PATCH v1 3/3] policycoreutils/setfiles: honor RESTORECON_THREADS jboero
2026-08-18 20:10 ` Stephen Smalley
2026-08-19 12:57 ` [PATCH v1 0/3] setfiles: control relabeling parallelism from the environment Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260818192340.119297-3-boeroboy@gmail.com \
--to=boeroboy@gmail.com \
--cc=cgzones@googlemail.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.