Todd's affinity code

Michal Jaegermann michal at harddata.com
Wed Apr 22 00:21:06 UTC 2009


On Tue, Apr 21, 2009 at 02:10:44PM -0700, Arne Chr. Jorgensen wrote:
> 
> Todd Denniston wrote:
> >
> > Question:
> > if you do
> > taskset -p 0x00000002 \
> >  `ps aux |grep /usr/bin/Xorg| \
> >   grep -v grep |awk '{print $2}'`
> >
> > {painful way to get the X pid to feed to taskset, which suggests to the kernel
> > keep the X process on the second processor.}
....
> 
> "..painful way to get the...", - not when you wrote it. But to compose anything
> like that oneself, - that is painful ;)

That is why a sane way to write something of that kind would be

   taskset -p 0x00000002 `pgrep Xorg`

Every time you see a pipe from grep to awk you immediately know that
something is wrong.

> But it did not improve.   

That what I would call painful.

    Michal

p.s.  Even on a system where pgrep and /sbin/pidof are not available
then something like

   ps ax | awk '/[X]org/{print $1}'

or similar will produce a desired process id.




More information about the fedora-test-list mailing list