Re: [PATCH] syscall interface for cpu affinity

Andreas Ferber (aferber@techfak.uni-bielefeld.de)
Mon, 11 Mar 2002 01:38:53 +0100


On Sun, Mar 10, 2002 at 01:15:03PM -0500, Robert Love wrote:
>
> This patch implements
>
> int sched_set_affinity(pid_t pid, unsigned int len,
> unsigned long *new_mask_ptr);
>
> int sched_get_affinity(pid_t pid, unsigned int *user_len_ptr,
> unsigned long *user_mask_ptr)
>
> which set and get the cpu affinity (task->cpus_allowed) for a task,
> using the set_cpus_allowed function in Ingo's scheduler. The functions
> properly support changes to cpus_allowed, implement security, and are
> well-tested.

Setting the affinity of a whole process group also makes sense IMHO.
Therefore I think an interface more like the setpriority syscall
for sched_set_affinity (with two parameters which/who instead of a
single PID) would be more flexible, eg.

int sched_set_affinity(int which, int who, unsigned int len,
unsigned long *new_mask_ptr);

with who one of {PRIO_PROCESS,PRIO_PGRP,PRIO_USER} and which according
to the value of who.

Getting the mask of a group of processes doesn't make sense though
(what if they differ?), so the current interface of sched_get_affinity
is just fine IMHO.

Andreas

-- 
       Andreas Ferber - dev/consulting GmbH - Bielefeld, FRG
     ---------------------------------------------------------
         +49 521 1365800 - af@devcon.net - www.devcon.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/