Skip to content

Commit 02390b8

Browse files
kirylIngo Molnar
authored andcommitted
mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS
With boot-time switching between paging mode we will have variable MAX_PHYSMEM_BITS. Let's use the maximum variable possible for CONFIG_X86_5LEVEL=y configuration to define zsmalloc data structures. The patch introduces MAX_POSSIBLE_PHYSMEM_BITS to cover such case. It also suits well to handle PAE special case. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reviewed-by: Nitin Gupta <ngupta@vflare.org> Acked-by: Minchan Kim <minchan@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20180214111656.88514-3-kirill.shutemov@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent b83ce5e commit 02390b8

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

arch/x86/include/asm/pgtable-3level_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ typedef union {
4444
*/
4545
#define PTRS_PER_PTE 512
4646

47+
#define MAX_POSSIBLE_PHYSMEM_BITS 36
4748

4849
#endif /* _ASM_X86_PGTABLE_3LEVEL_DEFS_H */

arch/x86/include/asm/pgtable_64_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ typedef struct { pteval_t pte; } pte_t;
4040
#define P4D_SIZE (_AC(1, UL) << P4D_SHIFT)
4141
#define P4D_MASK (~(P4D_SIZE - 1))
4242

43+
#define MAX_POSSIBLE_PHYSMEM_BITS 52
44+
4345
#else /* CONFIG_X86_5LEVEL */
4446

4547
/*

mm/zsmalloc.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,19 @@
8484
* This is made more complicated by various memory models and PAE.
8585
*/
8686

87-
#ifndef MAX_PHYSMEM_BITS
88-
#ifdef CONFIG_HIGHMEM64G
89-
#define MAX_PHYSMEM_BITS 36
90-
#else /* !CONFIG_HIGHMEM64G */
87+
#ifndef MAX_POSSIBLE_PHYSMEM_BITS
88+
#ifdef MAX_PHYSMEM_BITS
89+
#define MAX_POSSIBLE_PHYSMEM_BITS MAX_PHYSMEM_BITS
90+
#else
9191
/*
9292
* If this definition of MAX_PHYSMEM_BITS is used, OBJ_INDEX_BITS will just
9393
* be PAGE_SHIFT
9494
*/
95-
#define MAX_PHYSMEM_BITS BITS_PER_LONG
95+
#define MAX_POSSIBLE_PHYSMEM_BITS BITS_PER_LONG
9696
#endif
9797
#endif
98-
#define _PFN_BITS (MAX_PHYSMEM_BITS - PAGE_SHIFT)
98+
99+
#define _PFN_BITS (MAX_POSSIBLE_PHYSMEM_BITS - PAGE_SHIFT)
99100

100101
/*
101102
* Memory for allocating for handle keeps object position by

0 commit comments

Comments
 (0)