From: Rusty Russell <rusty@rustcorp.com.au>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: linux-kernel@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net
Subject: [PATCH] kdb: avoid on-stack cpumask, old-style accessors
Date: Wed, 27 Oct 2010 20:30:34 +1030 [thread overview]
Message-ID: <201010272030.34310.rusty@rustcorp.com.au> (raw)
That's quite a big stack already; I assume moving it to a static bitmap
is OK for this usage (a cpumask_var_t might require kmalloc, not sure
that's a good idea here).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: kgdb-bugreport@lists.sourceforge.net
Cc: Jason Wessel <jason.wessel@windriver.com>
---
kernel/debug/kdb/kdb_main.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2598,6 +2598,9 @@ static int kdb_summary(int argc, const c
return 0;
}
+/* Not sure when to initialize this, so make it a static bitmap. */
+static DECLARE_BITMAP(per_cpu_suppress, NR_CPUS);
+
/*
* kdb_per_cpu - This function implements the 'per_cpu' command.
*/
@@ -2605,7 +2608,7 @@ static int kdb_per_cpu(int argc, const c
{
char buf[256], fmtstr[64];
kdb_symtab_t symtab;
- cpumask_t suppress = CPU_MASK_NONE;
+ struct cpumask *suppress = to_cpumask(per_cpu_suppress);
int cpu, diag;
unsigned long addr, val, bytesperword = 0, whichcpu = ~0UL;
@@ -2649,7 +2652,7 @@ static int kdb_per_cpu(int argc, const c
#define KDB_PCU(cpu) 0
#endif
#endif
-
+ cpumask_clear(suppress);
for_each_online_cpu(cpu) {
if (whichcpu != ~0UL && whichcpu != cpu)
continue;
@@ -2662,7 +2665,7 @@ static int kdb_per_cpu(int argc, const c
}
#ifdef CONFIG_SMP
if (!val) {
- cpu_set(cpu, suppress);
+ cpumask_set_cpu(cpu, suppress);
continue;
}
#endif /* CONFIG_SMP */
@@ -2671,17 +2674,16 @@ static int kdb_per_cpu(int argc, const c
bytesperword == KDB_WORD_SIZE,
1, bytesperword, 1, 1, 0);
}
- if (cpus_weight(suppress) == 0)
+ if (cpumask_weight(suppress) == 0)
return 0;
kdb_printf("Zero suppressed cpu(s):");
- for (cpu = first_cpu(suppress); cpu < num_possible_cpus();
- cpu = next_cpu(cpu, suppress)) {
+ for_each_cpu(cpu, suppress) {
kdb_printf(" %d", cpu);
- if (cpu == num_possible_cpus() - 1 ||
- next_cpu(cpu, suppress) != cpu + 1)
+ if (cpu == nr_cpu_ids - 1 ||
+ cpumask_next(cpu, suppress) != cpu + 1)
continue;
- while (cpu < num_possible_cpus() &&
- next_cpu(cpu, suppress) == cpu + 1)
+ while (cpu < nr_cpu_ids &&
+ cpumask_next(cpu, suppress) == cpu + 1)
++cpu;
kdb_printf("-%d", cpu);
}
next reply other threads:[~2010-10-27 10:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 10:00 Rusty Russell [this message]
2010-10-27 11:44 ` [PATCH] kdb: avoid on-stack cpumask, old-style accessors Jason Wessel
2010-10-29 9:48 ` Rusty Russell
2010-10-29 13:11 ` Jason Wessel
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=201010272030.34310.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.