Re: cpuset and affinity implementation

From: Abdullah Ibn Hamad Al-Marri <wearabnet_at_yahoo.ca>
Date: Mon, 25 Feb 2008 07:29:44 -0800 (PST)
Jeff this is great!

Would it hit RELENG_7 in the future?
 
Regards, 
-Abdullah Ibn Hamad Al-Marri
Arab Portal


----- Original Message ----
From: Jeff Roberson <jroberson_at_chesapeake.net>
To: current_at_freebsd.org
Sent: Monday, February 25, 2008 6:38:37 AM
Subject: cpuset and affinity implementation


Hello,

I 
have 
implemented 
a 
new 
api 
similar 
to 
processors 
sets 
on 
solaris.  
This 
allows 
you 
to 
assign 
processes 
to 
sets 
of 
cpus 
and 
dynamically 
change 
those 
sets.  
This 
is 
useful 
for 
provisioning 
purposes 
to 
add 
and 
remove 
cpu 
resources 
for 
a 
particular 
process 
or 
group 
of 
processes.  
This 
new 
facility 
also 
supports 
binding 
secific 
threads 
to 
specific 
cpus 
which 
some 
applications 
may 
want 
to 
do.  
At 
some 
point 
in 
the 
future 
this 
will 
be 
integrated 
with 
jail 
so 
you 
can 
restrict 
the 
cpus 
any 
jail 
is 
allowed 
to 
use.

This 
api 
should 
not 
be 
considered 
final 
and 
the 
'cpuset' 
tool 
is 
quite 
rough.  
This 
also 
only 
works 
with 
ULE 
and 
is 
unfortunately 
intertwined 
with 
a 
big 
ULE 
patch 
I've 
been 
working 
on.  
The 
set 
management 
code 
is 
generic 
but 
4BSD 
doesn't 
contain 
the 
hooks 
to 
actually 
constrain 
threads.

Please 
see:
http://people.freebsd.org/~jeff/cpuset.diff

here's 
a 
couple 
of 
neat 
things 
to 
do 
with 
cpuset:

cpuset 
-l 
0-4 
/bin/sh

This 
creates 
a 
new 
group 
with 
a 
list 
(-l) 
of 
cpus 
0-4 
inclusive 
and 
runs 
sh 
in 
it.

cpuset 
-g 
-p 
<sh 
pid>

This 
will 
get 
(-g) 
the 
mask 
of 
cpus 
pid 
(-p) 
is 
allowed 
to 
run 
on.

cpuset 
-l 
0,2 
-p 
<sh 
pid>

This 
will 
restrict 
sh 
to 
running 
on 
cpus 
0, 
2 
while 
its 
group 
is 
still 
allowed 
0-4.

cpuset 
-l 
0,2 
-c 
-p 
<sh 
pid>

This 
will 
modify 
the 
cpuset 
(-c) 
that 
the 
sh 
belongs 
to.

cpuset 
-l 
0-3 
-s 
1

This 
will 
modify 
the 
set 
(-s) 
that 
all 
threads 
are 
in 
by 
default 
to 
contain 
the 
first 
4 
cpus 
leaving 
the 
rest 
idled.

cpuset 
-g 
-i 
-p 
<sh 
pid>

This 
will 
print 
the 
id 
of 
the 
set 
sh 
is 
in.

cpuset 
-s 
<set 
id> 
-p 
<pid>

This 
will 
move 
pid 
into 
the 
specified 
set 
so 
it 
may 
be 
managed 
with 
other 
pids 
in 
that 
set.

Feedback 
is 
appreciated.

Thanks,
Jeff
_______________________________________________
freebsd-current_at_freebsd.org 
mailing 
list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To 
unsubscribe, 
send 
any 
mail 
to 
"freebsd-current-unsubscribe_at_freebsd.org"







      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Received on Mon Feb 25 2008 - 14:56:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:28 UTC