[Toybox] new toy: taskset

Elie De Brauwer eliedebrauwer at gmail.com
Wed Jul 18 00:53:58 PDT 2012


On 07/18/2012 04:26 AM, Rob Landley wrote:
> On 07/15/2012 06:34 AM, Elie De Brauwer wrote:
>> Hello all,
>>
>> In attach you can find an initial version of 'taskset'. It allows
>> setting the cpu affinity of a given PID (or all tasks related with a
>> given PID/TID). cpu affinity should be entered in hex, when no affinity
>> is given the affinity for the process or the group of tasks is displayed.
>
> Where did the -a flag come from?  The taskset on my system matches this
> man page:

Whatever version of util-linux linux.die.net might 've stolen the 
manpage from, it for sure isn't a recent version. I just looked at the 
manpage on my debian system (util-linux-2.20.1) and it resembles this 
http://manpages.ubuntu.com/manpages/precise/man1/taskset.1.html  (you 
need to scroll down to see the options.
(I think this patch http://www.digipedia.pl/usenet/thread/19513/138/ 
more or less shows the -a specific changes).

>
>    http://linux.die.net/man/1/taskset
>
> In which taskset is a filter like nice, and -p says work on an existing
> pid instead of launching a new one. I'd guess -a is the behavior it
> always has, since "tasks" basically means "threads". (Unless containers
> use that too...)

Indeed, except that if you use it with -p, the -a is not default (so it 
will only look at the tid specified).


>
> By the way: "taskset -p [mask] pid" is _crazy_. pid should be an
> argument to -p, ala "taskset mask [-p pid | arg...].
>
> I'm not sure whether to consider the man page's command line
> grandfathered in (otherwise "taskset -p mask pid" won't work) or just go
> ahead and make the pid an argument to -p. I _can_ implement either but
> the current behavior makes no sense and there's no standard and your
> submission didn't even match what was there so it's not like that's
> _less_ compatible...
>

Well, my submission matches (or at least was intended) to match

taskset [-a] mask-in-hex pid

Meaning to works as renice, rather than nice. I'm open to suggestions, I 
can as well the 'work-as-nice' functionality,

> Confused,
>
> Rob


-- 
Elie De Brauwer


 1342598038.0


More information about the Toybox mailing list