Skip to content

Commit 4f8b96c

Browse files
committed
asm-generic: Provide kmap_size.h
kmap_types.h is a misnomer because the old atomic MAP based array does not exist anymore and the whole indirection of architectures including kmap_types.h is inconinstent and does not allow to provide guard page debugging for this misfeature. Add a common header file which defines the mapping stack size for all architectures. Will be used when converting architectures over to a generic kmap_local/atomic implementation. The array size is chosen with the following constraints in mind: - The deepest nest level in one context is 3 according to code inspection. - The worst case nesting for the upcoming reemptible version would be: 2 maps in task context and a fault inside 2 maps in the fault handler 3 maps in softirq 2 maps in interrupt So a total of 16 is sufficient and probably overestimated. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Cc: Andrew Morton <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 673afba commit 4f8b96c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/asm-generic/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ mandatory-y += irq_regs.h
3131
mandatory-y += irq_work.h
3232
mandatory-y += kdebug.h
3333
mandatory-y += kmap_types.h
34+
mandatory-y += kmap_size.h
3435
mandatory-y += kprobes.h
3536
mandatory-y += linkage.h
3637
mandatory-y += local.h

include/asm-generic/kmap_size.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_GENERIC_KMAP_SIZE_H
3+
#define _ASM_GENERIC_KMAP_SIZE_H
4+
5+
/* For debug this provides guard pages between the maps */
6+
#ifdef CONFIG_DEBUG_HIGHMEM
7+
# define KM_MAX_IDX 33
8+
#else
9+
# define KM_MAX_IDX 16
10+
#endif
11+
12+
#endif

0 commit comments

Comments
 (0)