]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/thp: make ALLOC_SPLIT_PTLOCKS dependent on USE_SPLIT_PTE_PTLOCKS
authorAnshuman Khandual <anshuman.khandual@arm.com>
Wed, 2 Jun 2021 03:52:58 +0000 (13:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Jun 2021 03:52:58 +0000 (13:52 +1000)
Split ptlocks need not be defined and allocated unless they are being
used.  ALLOC_SPLIT_PTLOCKS is inherently dependent on
USE_SPLIT_PTE_PTLOCKS.  This just makes it explicit and clear.  While here
drop the spinlock_t element from the struct page when
USE_SPLIT_PTE_PTLOCKS is not enabled.

Link: https://lkml.kernel.org/r/1621409586-5555-1-git-send-email-anshuman.khandual@arm.com
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
include/linux/mm_types.h
include/linux/mm_types_task.h
mm/memory.c

index fc55609ed3db574c8ab02bb055f9cc3320b93c75..a5869050ad28906870ab609d81c50092102b6ca8 100644 (file)
@@ -152,10 +152,12 @@ struct page {
                                struct mm_struct *pt_mm; /* x86 pgds only */
                                atomic_t pt_frag_refcount; /* powerpc */
                        };
+#if USE_SPLIT_PTE_PTLOCKS
 #if ALLOC_SPLIT_PTLOCKS
                        spinlock_t *ptl;
 #else
                        spinlock_t ptl;
+#endif
 #endif
                };
                struct {        /* ZONE_DEVICE pages */
index c1bc6731125cbbeb99b2bbe0d4757fad6bf5031f..1b222f8039d1088db4bb3e375d4f8adc8f673a26 100644 (file)
 #define USE_SPLIT_PTE_PTLOCKS  (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
 #define USE_SPLIT_PMD_PTLOCKS  (USE_SPLIT_PTE_PTLOCKS && \
                IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK))
+
+#if USE_SPLIT_PTE_PTLOCKS
 #define ALLOC_SPLIT_PTLOCKS    (SPINLOCK_SIZE > BITS_PER_LONG/8)
+#else
+#define ALLOC_SPLIT_PTLOCKS    0
+#endif
 
 /*
  * The per task VMA cache array:
index 087b0d53fa733fba8c00d5107a4b4eede33312a3..f85c2c322a23bd92e9a3f1b5b3972ef25ac63152 100644 (file)
@@ -5389,7 +5389,7 @@ long copy_huge_page_from_user(struct page *dst_page,
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
 
-#if USE_SPLIT_PTE_PTLOCKS && ALLOC_SPLIT_PTLOCKS
+#if ALLOC_SPLIT_PTLOCKS
 
 static struct kmem_cache *page_ptl_cachep;