Messages in this thread | | | Date | Mon, 05 Jan 2009 17:13:01 +0800 | From | Li Zefan <> | Subject | Re: [PATCH 4/6] cpuset: don't allocate trial cpuset on stack |
| |
>> -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.
| |