Re: (1/4) [PATCH] cpuset -- 2.6.0-test8

From: William Lee Irwin III
Date: Tue Oct 21 2003 - 19:11:04 EST


On Tue, Oct 21, 2003 at 04:20:19PM -0700, Stephen Hemminger wrote:
> +static const int N = (8*sizeof(cpumask_t));
> +/* mask must NOT be ZERO ! */
> +/* this is a cyclic version of next_cpu */
> +static inline void _next_cpu(const cpumask_t mask, int * index)
> +{
> + for(;;) {
> + if (++*index >= N) *index = 0;
> + if (cpu_isset(*index, mask)) return;
> + }
> +}

Best not to insist NR_CPUS % BITS_PER_LONG == 0.


On Tue, Oct 21, 2003 at 04:20:19PM -0700, Stephen Hemminger wrote:
> +/* When a cpuset with attached processes is being realloc'ed CPUs
> + * update the processes' masks and migrate them
> + */
> +static void migrate_cpuset_processes(struct cpuset * cs)
> +{
> + struct task_struct *g, *p;
> + /* This should be a RARE use of the cpusets.
> + * therefore we'll prefer an inefficient operation here
> + * (searching the whole process list)
> + * than adding another list_head in task_t
> + * and locks and list_add for each fork()
> + */

Unfair rwlocks can take boxen out when abused by quadratic algorithms.


-- wli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/