Skip to content

Commit

Permalink
cpuset: remove on stack cpumask_t in cpuset_sprintf_cpulist()
Browse files Browse the repository at this point in the history
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: Li Zefan <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Rusty Russell <[email protected]>
Acked-by: Mike Travis <[email protected]>
Cc: Paul Menage <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Li Zefan authored and torvalds committed Jan 8, 2009
1 parent f5813d9 commit 5a7625d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5a7625d

Please sign in to comment.