OoO  En ce  milieu de  nuit étoilée  du dimanche  09 octobre  2011, vers
04:24, Erik Torlen <erik.tor...@apicasystem.com> disait :

> I read a lot of people that have tried stud. This example is
> interesting in this case because he assigns the
> different processes to different cores with cpuset:
> http://vincent.bernat.im/en/blog/2011-ssl-benchmark.html

> In my case, would cpuset be the same as taskset? 

taskset is  more low level  than cpuset.  You  won't be able  to "evade"
from a  cpuset with taskset. But  if you don't use  cpuset (or cgroups),
taskset should work just fine.

Here is how I do with cpuset :

mkdir /dev/cpuset
mount -t cpuset cpuset /dev/cpuset
cd /dev/cpuset

# All system process on CPU 7
mkdir system
cd system
echo 7 > cpus
echo 0 > mems
while read i; do /bin/echo $i; done < ../tasks > tasks
cd ..
for i in $(seq 0 7); do
    mkdir cpu$i
    cd cpu$i
    echo $i > cpus
    echo 0 > mems
    cd ..
done

[...]

# Stud on CPU 3-6
PID=stud
i=0
for pid in $(pidof $PID); do
 echo $pid > /dev/cpuset/cpu$(($i + 3))/tasks
 i=$(( ($i+1) % 4))
done

At the end, just check that the process is properly pined down to wanted
CPU with /proc/PID/status:

Cpus_allowed_list:      5
-- 
Vincent Bernat ☯ http://vincent.bernat.im

Don't comment bad code - rewrite it.
            - The Elements of Programming Style (Kernighan & Plauger)

Reply via email to