Re: [PATCH 4/6] cpuset: don't allocate trial cpuset on stack

From: Li Zefan
Date: Mon Jan 05 2009 - 04:14:14 EST


>> -static int update_cpumask(struct cpuset *cs, const char *buf)
>> +static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
>> + const char *buf)
>> {
>> struct ptr_heap heap;
>> - struct cpuset trialcs;
>> int retval;
>> int is_load_balanced;
>>
>> @@ -891,8 +909,6 @@ static int update_cpumask(struct cpuset *cs, const char *buf)
>> if (cs == &top_cpuset)
>> return -EACCES;
>>
>> - trialcs = *cs;
>
> Yes, we already do.
>
> That thing contains spinlocks and list_heads (at least), which cannot
> be copied in this way.
>
> Seems that we're doing this gross thing because it just so happens that
> we only use the cpus_allowed and mems_allowed fields, and because

and also cpuset->flags.

> several of the called functions require a cpuset*, but only needed a
> cpumask_t.
>
> How perfectly beastly.
>

trial cpuset is used to ease the validation of changes to a cpuset. It
can be get rid of, but I'm afraid that the resulting code will be more
complex and less readable.
--
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/