Message ID | 8622e93b9c49c66ffdc9ef0aa8371c322718edd5.1390475530.git.viresh.kumar@linaro.org |
---|---|
State | New |
Headers | show |
On 24 January 2014 07:28, Li Zefan <lizefan@huawei.com> wrote: >> Acked-by: David Rientjes <rientjes@google.com> > > Acked-by: Li Zefan <lizefan@huawei.com> Thanks.. > I would like this patch be picked up by Tejun. I'll send out a patchset > for cpuset which may have confliction with this one. Its already applied by Andrew Morton..
On 24 January 2014 15:57, Tejun Heo <tj@kernel.org> wrote: > Ummm... so, the original posting forgot to cc Li (the maintainer), me > or cgroups mailing list. Please don't do this in the future. I thought Ingo/PeterZ are maintainers of this as well, just after sending patch I had a look at MAINTAINERS to see if I was wrong and forgot somebody. I saw Li there and sent a mail (private) to Li about this patch, I failed to see you or the cgroups list mentioned there for CPUSETS and so just sent mail to Li, otherwise I would have got all of you in loop.. Anyways, I forgot to add even Li in the first place, so yes accepted, probably would be better if we can updated Maintainers :)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 4410ac6..9ccdfb2 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -1326,16 +1326,18 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, if (err < 0) goto out; - err = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL); - if (err < 0) - goto out; - balance_flag_changed = (is_sched_load_balance(cs) != is_sched_load_balance(trialcs)); spread_flag_changed = ((is_spread_slab(cs) != is_spread_slab(trialcs)) || (is_spread_page(cs) != is_spread_page(trialcs))); + if (spread_flag_changed) { + err = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL); + if (err < 0) + goto out; + } + mutex_lock(&callback_mutex); cs->flags = trialcs->flags; mutex_unlock(&callback_mutex); @@ -1343,9 +1345,10 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, if (!cpumask_empty(trialcs->cpus_allowed) && balance_flag_changed) rebuild_sched_domains_locked(); - if (spread_flag_changed) + if (spread_flag_changed) { update_tasks_flags(cs, &heap); - heap_free(&heap); + heap_free(&heap); + } out: free_trial_cpuset(trialcs); return err;
update_flag() routine uses heap only when spread_flag_changed is true. Otherwise heap isn't used, but is allocated and freed unnecessarily. Fix this by allocating heap only when required. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- Rebased over linux-next/master kernel/cpuset.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)