diff options
author | Mike Travis <travis@sgi.com> | 2008-04-04 21:11:08 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-19 13:44:59 -0400 |
commit | b53e921ba1cff8453dc9a87a84052fa12d5b30bd (patch) | |
tree | 021cadb6c58543ecccd95b55fc319f249ebf176e /kernel | |
parent | f9a86fcbbb1e5542eabf45c9144ac4b6330861a4 (diff) |
generic: reduce stack pressure in sched_affinity
* Modify sched_affinity functions to pass cpumask_t variables by reference
instead of by value.
* Use new set_cpus_allowed_ptr function.
Depends on:
[sched-devel]: sched: add new set_cpus_allowed_ptr function
Cc: Paul Jackson <pj@sgi.com>
Cc: Cliff Wickman <cpw@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/compat.c | 2 | ||||
-rw-r--r-- | kernel/rcupreempt.c | 4 | ||||
-rw-r--r-- | kernel/sched.c | 5 |
3 files changed, 6 insertions, 5 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index 9c48abfcd4a5..e1ef04870c2a 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -445,7 +445,7 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, | |||
445 | if (retval) | 445 | if (retval) |
446 | return retval; | 446 | return retval; |
447 | 447 | ||
448 | return sched_setaffinity(pid, new_mask); | 448 | return sched_setaffinity(pid, &new_mask); |
449 | } | 449 | } |
450 | 450 | ||
451 | asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, | 451 | asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, |
diff --git a/kernel/rcupreempt.c b/kernel/rcupreempt.c index e9517014b57c..e1cdf196a515 100644 --- a/kernel/rcupreempt.c +++ b/kernel/rcupreempt.c | |||
@@ -1007,10 +1007,10 @@ void __synchronize_sched(void) | |||
1007 | if (sched_getaffinity(0, &oldmask) < 0) | 1007 | if (sched_getaffinity(0, &oldmask) < 0) |
1008 | oldmask = cpu_possible_map; | 1008 | oldmask = cpu_possible_map; |
1009 | for_each_online_cpu(cpu) { | 1009 | for_each_online_cpu(cpu) { |
1010 | sched_setaffinity(0, cpumask_of_cpu(cpu)); | 1010 | sched_setaffinity(0, &cpumask_of_cpu(cpu)); |
1011 | schedule(); | 1011 | schedule(); |
1012 | } | 1012 | } |
1013 | sched_setaffinity(0, oldmask); | 1013 | sched_setaffinity(0, &oldmask); |
1014 | } | 1014 | } |
1015 | EXPORT_SYMBOL_GPL(__synchronize_sched); | 1015 | EXPORT_SYMBOL_GPL(__synchronize_sched); |
1016 | 1016 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index ccc23a9cd264..1a8252385c4d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4908,9 +4908,10 @@ out_unlock: | |||
4908 | return retval; | 4908 | return retval; |
4909 | } | 4909 | } |
4910 | 4910 | ||
4911 | long sched_setaffinity(pid_t pid, cpumask_t new_mask) | 4911 | long sched_setaffinity(pid_t pid, const cpumask_t *in_mask) |
4912 | { | 4912 | { |
4913 | cpumask_t cpus_allowed; | 4913 | cpumask_t cpus_allowed; |
4914 | cpumask_t new_mask = *in_mask; | ||
4914 | struct task_struct *p; | 4915 | struct task_struct *p; |
4915 | int retval; | 4916 | int retval; |
4916 | 4917 | ||
@@ -4991,7 +4992,7 @@ asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, | |||
4991 | if (retval) | 4992 | if (retval) |
4992 | return retval; | 4993 | return retval; |
4993 | 4994 | ||
4994 | return sched_setaffinity(pid, new_mask); | 4995 | return sched_setaffinity(pid, &new_mask); |
4995 | } | 4996 | } |
4996 | 4997 | ||
4997 | /* | 4998 | /* |