提交 5a7625df 编写于 作者: L Li Zefan 提交者: Linus Torvalds

cpuset: remove on stack cpumask_t in cpuset_sprintf_cpulist()

This patchset converts cpuset to use new cpumask API, and thus
remove on stack cpumask_t to reduce stack usage.

Before:
 # cat kernel/cpuset.c include/linux/cpuset.h | grep -c cpumask_t
 21
After:
 # cat kernel/cpuset.c include/linux/cpuset.h | grep -c cpumask_t
 0

This patch:

Impact: reduce stack usage

It's safe to call cpulist_scnprintf inside callback_mutex, and thus we can
just remove the cpumask_t and no need to allocate a cpumask_var_t.
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: NMike Travis <travis@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f5813d94
......@@ -1486,13 +1486,13 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft,
static int cpuset_sprintf_cpulist(char *page, struct cpuset *cs)
{
cpumask_t mask;
int ret;
mutex_lock(&callback_mutex);
mask = cs->cpus_allowed;
ret = cpulist_scnprintf(page, PAGE_SIZE, &cs->cpus_allowed);
mutex_unlock(&callback_mutex);
return cpulist_scnprintf(page, PAGE_SIZE, &mask);
return ret;
}
static int cpuset_sprintf_memlist(char *page, struct cpuset *cs)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册