Bug 142434 - [patch] Add cpuset(1) support to rc.subr(8)
Summary: [patch] Add cpuset(1) support to rc.subr(8)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 7.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2010-01-07 18:40 UTC by Miroslav Lachman
Modified: 2020-07-12 05:21 UTC (History)
0 users

See Also:

file.diff (2.14 KB, patch)
2010-01-07 18:40 UTC, Miroslav Lachman
no flags Details | Diff
cpuset_rc.subr_72.patch (2.12 KB, patch)
2010-01-07 18:58 UTC, Miroslav Lachman
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Lachman 2010-01-07 18:40:00 UTC
Add support for cpuset(1) to rc.subr
If ${name}_cpuset is specified, command will be runned on specified CPUs.

cpuset is available in STABLE branch for more than one year (7.1+), but is still not widely known / used and there is no general support to use cpuset in rc scripts.
FreeBSD can benefit from feature like this compared to other OSes.

Fix: Apply attached patch and try something like this in /etc/rc.conf


Then after boot or restart of services, you will have services assigned to defined CPUs like this:

# /usr/local/etc/rc.d/mysql-server status
mysql is running as pid 11952.
on CPU(s) 1,2,3

# /usr/local/etc/rc.d/lighttpd status
lighttpd is running as pid 12011.
on CPU(s) 2

# /usr/local/etc/rc.d/proftpd status
proftpd is running as pid 11882.
on CPU(s) 1,2

The patch is not fully tested, but allows most currently available services to be assigned to CPUs without modification of existing rc scripts.

Note: some complex rc scripts can not use cpuset, for example rc.d/jail

patch is for 9-CURRENT but should work on older releases too

Patch attached with submission follows:
Comment 1 Miroslav Lachman 2010-01-07 18:58:46 UTC
Attached patch is for 7.2-RELEASE
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-01-07 19:15:18 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 3 Miroslav Lachman 2011-04-26 12:24:19 UTC
Can some committer reply to this PR if there are any interest to have 
this feature in base rc.subr for 9.0 RELEASE?
Should I change something in the patch?

Otherwise this PR can be closed if there is some reason not to have it.

Miroslav Lachman
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:09 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped