Skip to content

Commit 5dd4072

Browse files
xzpeterakpm00
authored andcommitted
mm: allow THP orders for PFNMAPs
This enables PFNMAPs to be mapped at either pmd/pud layers. Generalize the dax case into vma_is_special_huge() so as to cover both. Meanwhile, rename the macro to THP_ORDERS_ALL_SPECIAL. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Acked-by: David Hildenbrand <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Gavin Shan <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Zi Yan <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Niklas Schnelle <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3c8e44c commit 5dd4072

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/linux/huge_mm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ extern struct kobj_attribute thpsize_shmem_enabled_attr;
7676
/*
7777
* Mask of all large folio orders supported for file THP. Folios in a DAX
7878
* file is never split and the MAX_PAGECACHE_ORDER limit does not apply to
79-
* it.
79+
* it. Same to PFNMAPs where there's neither page* nor pagecache.
8080
*/
81-
#define THP_ORDERS_ALL_FILE_DAX \
81+
#define THP_ORDERS_ALL_SPECIAL \
8282
(BIT(PMD_ORDER) | BIT(PUD_ORDER))
8383
#define THP_ORDERS_ALL_FILE_DEFAULT \
8484
((BIT(MAX_PAGECACHE_ORDER + 1) - 1) & ~BIT(0))
@@ -87,7 +87,7 @@ extern struct kobj_attribute thpsize_shmem_enabled_attr;
8787
* Mask of all large folio orders supported for THP.
8888
*/
8989
#define THP_ORDERS_ALL \
90-
(THP_ORDERS_ALL_ANON | THP_ORDERS_ALL_FILE_DAX | THP_ORDERS_ALL_FILE_DEFAULT)
90+
(THP_ORDERS_ALL_ANON | THP_ORDERS_ALL_SPECIAL | THP_ORDERS_ALL_FILE_DEFAULT)
9191

9292
#define TVA_SMAPS (1 << 0) /* Will be used for procfs */
9393
#define TVA_IN_PF (1 << 1) /* Page fault handler */

mm/huge_memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
9797
/* Check the intersection of requested and supported orders. */
9898
if (vma_is_anonymous(vma))
9999
supported_orders = THP_ORDERS_ALL_ANON;
100-
else if (vma_is_dax(vma))
101-
supported_orders = THP_ORDERS_ALL_FILE_DAX;
100+
else if (vma_is_special_huge(vma))
101+
supported_orders = THP_ORDERS_ALL_SPECIAL;
102102
else
103103
supported_orders = THP_ORDERS_ALL_FILE_DEFAULT;
104104

0 commit comments

Comments
 (0)