Skip to content

Commit 0d44975

Browse files
dvlasenkIngo Molnar
authored andcommitted
x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap
Straigntforward conversion from: int was_in_debug_nmi[NR_CPUS] to: DECLARE_BITMAP(was_in_debug_nmi, NR_CPUS) Saves about 2 kbytes in BSS for NR_CPUS=512. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/1443271638-2568-1-git-send-email-dvlasenk@redhat.com [ Tidied up the code a bit. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 097f70b commit 0d44975

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

arch/x86/kernel/kgdb.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,26 +511,31 @@ single_step_cont(struct pt_regs *regs, struct die_args *args)
511511
return NOTIFY_STOP;
512512
}
513513

514-
static int was_in_debug_nmi[NR_CPUS];
514+
static DECLARE_BITMAP(was_in_debug_nmi, NR_CPUS);
515515

516516
static int kgdb_nmi_handler(unsigned int cmd, struct pt_regs *regs)
517517
{
518+
int cpu;
519+
518520
switch (cmd) {
519521
case NMI_LOCAL:
520522
if (atomic_read(&kgdb_active) != -1) {
521523
/* KGDB CPU roundup */
522-
kgdb_nmicallback(raw_smp_processor_id(), regs);
523-
was_in_debug_nmi[raw_smp_processor_id()] = 1;
524+
cpu = raw_smp_processor_id();
525+
kgdb_nmicallback(cpu, regs);
526+
set_bit(cpu, was_in_debug_nmi);
524527
touch_nmi_watchdog();
528+
525529
return NMI_HANDLED;
526530
}
527531
break;
528532

529533
case NMI_UNKNOWN:
530-
if (was_in_debug_nmi[raw_smp_processor_id()]) {
531-
was_in_debug_nmi[raw_smp_processor_id()] = 0;
534+
cpu = raw_smp_processor_id();
535+
536+
if (__test_and_clear_bit(cpu, was_in_debug_nmi))
532537
return NMI_HANDLED;
533-
}
538+
534539
break;
535540
default:
536541
/* do nothing */

0 commit comments

Comments
 (0)