From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Cc: Jack Steiner <steiner@sgi.com>, Jes Sorensen <jes@sgi.com>,
David Miller <davem@davemloft.net>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] smp: reduce stack requirements for smp_call_function_mask
Date: Fri, 05 Sep 2008 14:40:20 -0700 [thread overview]
Message-ID: <20080905214020.115286000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: 20080905214019.821172000@polaris-admin.engr.sgi.com
[-- Attachment #1: smp_call_function_mask --]
[-- Type: text/plain, Size: 1817 bytes --]
* Cleanup cpumask_t usages in smp_call_function_mask to remove stack
overflow problem when NR_CPUS=4096. This removes over 1000 bytes
from the stack with NR_CPUS=4096.
Based on 2.6.27-rc5-git6.
Applies to linux-2.6.tip/master (with FUZZ).
Signed-off-by: Mike Travis <travis@sgi.com>
---
kernel/smp.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
--- linux-2.6.orig/kernel/smp.c
+++ linux-2.6/kernel/smp.c
@@ -303,7 +303,7 @@ static int check_stack_overflow(void)
* If a faster scheme can be made, we could go back to preferring stack based
* data -- the data allocation/free is non-zero cost.
*/
-static void smp_call_function_mask_quiesce_stack(cpumask_t mask)
+static void smp_call_function_mask_quiesce_stack(const cpumask_t *mask)
{
struct call_single_data data;
int cpu;
@@ -311,7 +311,7 @@ static void smp_call_function_mask_quies
data.func = quiesce_dummy;
data.info = NULL;
- for_each_cpu_mask(cpu, mask) {
+ for_each_cpu_mask_nr(cpu, *mask) {
data.flags = CSD_FLAG_WAIT;
generic_exec_single(cpu, &data);
}
@@ -339,7 +339,6 @@ int smp_call_function_mask(cpumask_t mas
{
struct call_function_data d;
struct call_function_data *data = NULL;
- cpumask_t allbutself;
unsigned long flags;
int cpu, num_cpus;
int slowpath = 0;
@@ -353,9 +352,8 @@ dump_stack();
WARN_ON(irqs_disabled());
cpu = smp_processor_id();
- allbutself = cpu_online_map;
- cpu_clear(cpu, allbutself);
- cpus_and(mask, mask, allbutself);
+ cpus_and(mask, mask, cpu_online_map);
+ cpu_clear(cpu, mask);
num_cpus = cpus_weight(mask);
/*
@@ -398,7 +396,7 @@ dump_stack();
if (wait) {
csd_flag_wait(&data->csd);
if (unlikely(slowpath))
- smp_call_function_mask_quiesce_stack(mask);
+ smp_call_function_mask_quiesce_stack(&mask);
}
return 0;
next prev parent reply other threads:[~2008-09-05 21:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-05 21:40 [PATCH 0/3] smp: reduce stack requirements for smp_call_function_mask Mike Travis
2008-09-05 21:40 ` Mike Travis [this message]
2008-09-05 21:40 ` [PATCH 2/3] x86: reduce stack requirements for send_call_func_ipi Mike Travis
2008-09-05 21:40 ` [PATCH 3/3] x86: restore 4096 limit for NR_CPUS Mike Travis
2008-09-06 13:29 ` [PATCH 0/3] smp: reduce stack requirements for smp_call_function_mask Ingo Molnar
2008-09-06 18:12 ` Mike Travis
2008-09-06 18:21 ` Ingo Molnar
2008-09-08 10:30 ` Nick Piggin
2008-09-08 15:47 ` Mike Travis
2008-09-08 19:51 ` David Miller
2008-09-08 20:11 ` Mike Travis
2008-09-08 20:48 ` David Miller
2008-09-08 9:48 ` Jes Sorensen
2008-09-08 15:41 ` Mike Travis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080905214020.115286000@polaris-admin.engr.sgi.com \
--to=travis@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jes@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=steiner@sgi.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).