at v6.12 668 lines 20 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_HUGE_MM_H 3#define _LINUX_HUGE_MM_H 4 5#include <linux/sched/coredump.h> 6#include <linux/mm_types.h> 7 8#include <linux/fs.h> /* only for vma_is_dax() */ 9#include <linux/kobject.h> 10 11vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf); 12int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, 13 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, 14 struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma); 15void huge_pmd_set_accessed(struct vm_fault *vmf); 16int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm, 17 pud_t *dst_pud, pud_t *src_pud, unsigned long addr, 18 struct vm_area_struct *vma); 19 20#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD 21void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud); 22#else 23static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud) 24{ 25} 26#endif 27 28vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf); 29bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, 30 pmd_t *pmd, unsigned long addr, unsigned long next); 31int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, pmd_t *pmd, 32 unsigned long addr); 33int zap_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma, pud_t *pud, 34 unsigned long addr); 35bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, 36 unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd); 37int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, 38 pmd_t *pmd, unsigned long addr, pgprot_t newprot, 39 unsigned long cp_flags); 40 41vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write); 42vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write); 43 44enum transparent_hugepage_flag { 45 TRANSPARENT_HUGEPAGE_UNSUPPORTED, 46 TRANSPARENT_HUGEPAGE_FLAG, 47 TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, 48 TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, 49 TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, 50 TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, 51 TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, 52 TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG, 53 TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG, 54}; 55 56struct kobject; 57struct kobj_attribute; 58 59ssize_t single_hugepage_flag_store(struct kobject *kobj, 60 struct kobj_attribute *attr, 61 const char *buf, size_t count, 62 enum transparent_hugepage_flag flag); 63ssize_t single_hugepage_flag_show(struct kobject *kobj, 64 struct kobj_attribute *attr, char *buf, 65 enum transparent_hugepage_flag flag); 66extern struct kobj_attribute shmem_enabled_attr; 67extern struct kobj_attribute thpsize_shmem_enabled_attr; 68 69/* 70 * Mask of all large folio orders supported for anonymous THP; all orders up to 71 * and including PMD_ORDER, except order-0 (which is not "huge") and order-1 72 * (which is a limitation of the THP implementation). 73 */ 74#define THP_ORDERS_ALL_ANON ((BIT(PMD_ORDER + 1) - 1) & ~(BIT(0) | BIT(1))) 75 76/* 77 * Mask of all large folio orders supported for file THP. Folios in a DAX 78 * file is never split and the MAX_PAGECACHE_ORDER limit does not apply to 79 * it. Same to PFNMAPs where there's neither page* nor pagecache. 80 */ 81#define THP_ORDERS_ALL_SPECIAL \ 82 (BIT(PMD_ORDER) | BIT(PUD_ORDER)) 83#define THP_ORDERS_ALL_FILE_DEFAULT \ 84 ((BIT(MAX_PAGECACHE_ORDER + 1) - 1) & ~BIT(0)) 85 86/* 87 * Mask of all large folio orders supported for THP. 88 */ 89#define THP_ORDERS_ALL \ 90 (THP_ORDERS_ALL_ANON | THP_ORDERS_ALL_SPECIAL | THP_ORDERS_ALL_FILE_DEFAULT) 91 92#define TVA_SMAPS (1 << 0) /* Will be used for procfs */ 93#define TVA_IN_PF (1 << 1) /* Page fault handler */ 94#define TVA_ENFORCE_SYSFS (1 << 2) /* Obey sysfs configuration */ 95 96#define thp_vma_allowable_order(vma, vm_flags, tva_flags, order) \ 97 (!!thp_vma_allowable_orders(vma, vm_flags, tva_flags, BIT(order))) 98 99#define split_folio(f) split_folio_to_list(f, NULL) 100 101#ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES 102#define HPAGE_PMD_SHIFT PMD_SHIFT 103#define HPAGE_PUD_SHIFT PUD_SHIFT 104#else 105#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) 106#define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; }) 107#endif 108 109#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) 110#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) 111#define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1)) 112#define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT) 113 114#define HPAGE_PUD_ORDER (HPAGE_PUD_SHIFT-PAGE_SHIFT) 115#define HPAGE_PUD_NR (1<<HPAGE_PUD_ORDER) 116#define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1)) 117#define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT) 118 119enum mthp_stat_item { 120 MTHP_STAT_ANON_FAULT_ALLOC, 121 MTHP_STAT_ANON_FAULT_FALLBACK, 122 MTHP_STAT_ANON_FAULT_FALLBACK_CHARGE, 123 MTHP_STAT_SWPOUT, 124 MTHP_STAT_SWPOUT_FALLBACK, 125 MTHP_STAT_SHMEM_ALLOC, 126 MTHP_STAT_SHMEM_FALLBACK, 127 MTHP_STAT_SHMEM_FALLBACK_CHARGE, 128 MTHP_STAT_SPLIT, 129 MTHP_STAT_SPLIT_FAILED, 130 MTHP_STAT_SPLIT_DEFERRED, 131 MTHP_STAT_NR_ANON, 132 MTHP_STAT_NR_ANON_PARTIALLY_MAPPED, 133 __MTHP_STAT_COUNT 134}; 135 136#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_SYSFS) 137struct mthp_stat { 138 unsigned long stats[ilog2(MAX_PTRS_PER_PTE) + 1][__MTHP_STAT_COUNT]; 139}; 140 141DECLARE_PER_CPU(struct mthp_stat, mthp_stats); 142 143static inline void mod_mthp_stat(int order, enum mthp_stat_item item, int delta) 144{ 145 if (order <= 0 || order > PMD_ORDER) 146 return; 147 148 this_cpu_add(mthp_stats.stats[order][item], delta); 149} 150 151static inline void count_mthp_stat(int order, enum mthp_stat_item item) 152{ 153 mod_mthp_stat(order, item, 1); 154} 155 156#else 157static inline void mod_mthp_stat(int order, enum mthp_stat_item item, int delta) 158{ 159} 160 161static inline void count_mthp_stat(int order, enum mthp_stat_item item) 162{ 163} 164#endif 165 166#ifdef CONFIG_TRANSPARENT_HUGEPAGE 167 168extern unsigned long transparent_hugepage_flags; 169extern unsigned long huge_anon_orders_always; 170extern unsigned long huge_anon_orders_madvise; 171extern unsigned long huge_anon_orders_inherit; 172 173static inline bool hugepage_global_enabled(void) 174{ 175 return transparent_hugepage_flags & 176 ((1<<TRANSPARENT_HUGEPAGE_FLAG) | 177 (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG)); 178} 179 180static inline bool hugepage_global_always(void) 181{ 182 return transparent_hugepage_flags & 183 (1<<TRANSPARENT_HUGEPAGE_FLAG); 184} 185 186static inline int highest_order(unsigned long orders) 187{ 188 return fls_long(orders) - 1; 189} 190 191static inline int next_order(unsigned long *orders, int prev) 192{ 193 *orders &= ~BIT(prev); 194 return highest_order(*orders); 195} 196 197/* 198 * Do the below checks: 199 * - For file vma, check if the linear page offset of vma is 200 * order-aligned within the file. The hugepage is 201 * guaranteed to be order-aligned within the file, but we must 202 * check that the order-aligned addresses in the VMA map to 203 * order-aligned offsets within the file, else the hugepage will 204 * not be mappable. 205 * - For all vmas, check if the haddr is in an aligned hugepage 206 * area. 207 */ 208static inline bool thp_vma_suitable_order(struct vm_area_struct *vma, 209 unsigned long addr, int order) 210{ 211 unsigned long hpage_size = PAGE_SIZE << order; 212 unsigned long haddr; 213 214 /* Don't have to check pgoff for anonymous vma */ 215 if (!vma_is_anonymous(vma)) { 216 if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff, 217 hpage_size >> PAGE_SHIFT)) 218 return false; 219 } 220 221 haddr = ALIGN_DOWN(addr, hpage_size); 222 223 if (haddr < vma->vm_start || haddr + hpage_size > vma->vm_end) 224 return false; 225 return true; 226} 227 228/* 229 * Filter the bitfield of input orders to the ones suitable for use in the vma. 230 * See thp_vma_suitable_order(). 231 * All orders that pass the checks are returned as a bitfield. 232 */ 233static inline unsigned long thp_vma_suitable_orders(struct vm_area_struct *vma, 234 unsigned long addr, unsigned long orders) 235{ 236 int order; 237 238 /* 239 * Iterate over orders, highest to lowest, removing orders that don't 240 * meet alignment requirements from the set. Exit loop at first order 241 * that meets requirements, since all lower orders must also meet 242 * requirements. 243 */ 244 245 order = highest_order(orders); 246 247 while (orders) { 248 if (thp_vma_suitable_order(vma, addr, order)) 249 break; 250 order = next_order(&orders, order); 251 } 252 253 return orders; 254} 255 256static inline bool file_thp_enabled(struct vm_area_struct *vma) 257{ 258 struct inode *inode; 259 260 if (!vma->vm_file) 261 return false; 262 263 inode = vma->vm_file->f_inode; 264 265 return (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS)) && 266 !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode); 267} 268 269unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma, 270 unsigned long vm_flags, 271 unsigned long tva_flags, 272 unsigned long orders); 273 274/** 275 * thp_vma_allowable_orders - determine hugepage orders that are allowed for vma 276 * @vma: the vm area to check 277 * @vm_flags: use these vm_flags instead of vma->vm_flags 278 * @tva_flags: Which TVA flags to honour 279 * @orders: bitfield of all orders to consider 280 * 281 * Calculates the intersection of the requested hugepage orders and the allowed 282 * hugepage orders for the provided vma. Permitted orders are encoded as a set 283 * bit at the corresponding bit position (bit-2 corresponds to order-2, bit-3 284 * corresponds to order-3, etc). Order-0 is never considered a hugepage order. 285 * 286 * Return: bitfield of orders allowed for hugepage in the vma. 0 if no hugepage 287 * orders are allowed. 288 */ 289static inline 290unsigned long thp_vma_allowable_orders(struct vm_area_struct *vma, 291 unsigned long vm_flags, 292 unsigned long tva_flags, 293 unsigned long orders) 294{ 295 /* Optimization to check if required orders are enabled early. */ 296 if ((tva_flags & TVA_ENFORCE_SYSFS) && vma_is_anonymous(vma)) { 297 unsigned long mask = READ_ONCE(huge_anon_orders_always); 298 299 if (vm_flags & VM_HUGEPAGE) 300 mask |= READ_ONCE(huge_anon_orders_madvise); 301 if (hugepage_global_always() || 302 ((vm_flags & VM_HUGEPAGE) && hugepage_global_enabled())) 303 mask |= READ_ONCE(huge_anon_orders_inherit); 304 305 orders &= mask; 306 if (!orders) 307 return 0; 308 } 309 310 return __thp_vma_allowable_orders(vma, vm_flags, tva_flags, orders); 311} 312 313struct thpsize { 314 struct kobject kobj; 315 struct list_head node; 316 int order; 317}; 318 319#define to_thpsize(kobj) container_of(kobj, struct thpsize, kobj) 320 321#define transparent_hugepage_use_zero_page() \ 322 (transparent_hugepage_flags & \ 323 (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG)) 324 325static inline bool vma_thp_disabled(struct vm_area_struct *vma, 326 unsigned long vm_flags) 327{ 328 /* 329 * Explicitly disabled through madvise or prctl, or some 330 * architectures may disable THP for some mappings, for 331 * example, s390 kvm. 332 */ 333 return (vm_flags & VM_NOHUGEPAGE) || 334 test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags); 335} 336 337static inline bool thp_disabled_by_hw(void) 338{ 339 /* If the hardware/firmware marked hugepage support disabled. */ 340 return transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED); 341} 342 343unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr, 344 unsigned long len, unsigned long pgoff, unsigned long flags); 345unsigned long thp_get_unmapped_area_vmflags(struct file *filp, unsigned long addr, 346 unsigned long len, unsigned long pgoff, unsigned long flags, 347 vm_flags_t vm_flags); 348 349bool can_split_folio(struct folio *folio, int caller_pins, int *pextra_pins); 350int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, 351 unsigned int new_order); 352int min_order_for_split(struct folio *folio); 353int split_folio_to_list(struct folio *folio, struct list_head *list); 354static inline int split_huge_page(struct page *page) 355{ 356 struct folio *folio = page_folio(page); 357 int ret = min_order_for_split(folio); 358 359 if (ret < 0) 360 return ret; 361 362 /* 363 * split_huge_page() locks the page before splitting and 364 * expects the same page that has been split to be locked when 365 * returned. split_folio(page_folio(page)) cannot be used here 366 * because it converts the page to folio and passes the head 367 * page to be split. 368 */ 369 return split_huge_page_to_list_to_order(page, NULL, ret); 370} 371void deferred_split_folio(struct folio *folio, bool partially_mapped); 372 373void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 374 unsigned long address, bool freeze, struct folio *folio); 375 376#define split_huge_pmd(__vma, __pmd, __address) \ 377 do { \ 378 pmd_t *____pmd = (__pmd); \ 379 if (is_swap_pmd(*____pmd) || pmd_trans_huge(*____pmd) \ 380 || pmd_devmap(*____pmd)) \ 381 __split_huge_pmd(__vma, __pmd, __address, \ 382 false, NULL); \ 383 } while (0) 384 385 386void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address, 387 bool freeze, struct folio *folio); 388 389void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud, 390 unsigned long address); 391 392#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD 393int change_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma, 394 pud_t *pudp, unsigned long addr, pgprot_t newprot, 395 unsigned long cp_flags); 396#else 397static inline int 398change_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma, 399 pud_t *pudp, unsigned long addr, pgprot_t newprot, 400 unsigned long cp_flags) { return 0; } 401#endif 402 403#define split_huge_pud(__vma, __pud, __address) \ 404 do { \ 405 pud_t *____pud = (__pud); \ 406 if (pud_trans_huge(*____pud) \ 407 || pud_devmap(*____pud)) \ 408 __split_huge_pud(__vma, __pud, __address); \ 409 } while (0) 410 411int hugepage_madvise(struct vm_area_struct *vma, unsigned long *vm_flags, 412 int advice); 413int madvise_collapse(struct vm_area_struct *vma, 414 struct vm_area_struct **prev, 415 unsigned long start, unsigned long end); 416void vma_adjust_trans_huge(struct vm_area_struct *vma, unsigned long start, 417 unsigned long end, long adjust_next); 418spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma); 419spinlock_t *__pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma); 420 421static inline int is_swap_pmd(pmd_t pmd) 422{ 423 return !pmd_none(pmd) && !pmd_present(pmd); 424} 425 426/* mmap_lock must be held on entry */ 427static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, 428 struct vm_area_struct *vma) 429{ 430 if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) 431 return __pmd_trans_huge_lock(pmd, vma); 432 else 433 return NULL; 434} 435static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, 436 struct vm_area_struct *vma) 437{ 438 if (pud_trans_huge(*pud) || pud_devmap(*pud)) 439 return __pud_trans_huge_lock(pud, vma); 440 else 441 return NULL; 442} 443 444/** 445 * folio_test_pmd_mappable - Can we map this folio with a PMD? 446 * @folio: The folio to test 447 */ 448static inline bool folio_test_pmd_mappable(struct folio *folio) 449{ 450 return folio_order(folio) >= HPAGE_PMD_ORDER; 451} 452 453struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr, 454 pmd_t *pmd, int flags, struct dev_pagemap **pgmap); 455 456vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf); 457 458extern struct folio *huge_zero_folio; 459extern unsigned long huge_zero_pfn; 460 461static inline bool is_huge_zero_folio(const struct folio *folio) 462{ 463 return READ_ONCE(huge_zero_folio) == folio; 464} 465 466static inline bool is_huge_zero_pmd(pmd_t pmd) 467{ 468 return pmd_present(pmd) && READ_ONCE(huge_zero_pfn) == pmd_pfn(pmd); 469} 470 471struct folio *mm_get_huge_zero_folio(struct mm_struct *mm); 472void mm_put_huge_zero_folio(struct mm_struct *mm); 473 474#define mk_huge_pmd(page, prot) pmd_mkhuge(mk_pmd(page, prot)) 475 476static inline bool thp_migration_supported(void) 477{ 478 return IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION); 479} 480 481void split_huge_pmd_locked(struct vm_area_struct *vma, unsigned long address, 482 pmd_t *pmd, bool freeze, struct folio *folio); 483bool unmap_huge_pmd_locked(struct vm_area_struct *vma, unsigned long addr, 484 pmd_t *pmdp, struct folio *folio); 485 486#else /* CONFIG_TRANSPARENT_HUGEPAGE */ 487 488static inline bool folio_test_pmd_mappable(struct folio *folio) 489{ 490 return false; 491} 492 493static inline bool thp_vma_suitable_order(struct vm_area_struct *vma, 494 unsigned long addr, int order) 495{ 496 return false; 497} 498 499static inline unsigned long thp_vma_suitable_orders(struct vm_area_struct *vma, 500 unsigned long addr, unsigned long orders) 501{ 502 return 0; 503} 504 505static inline unsigned long thp_vma_allowable_orders(struct vm_area_struct *vma, 506 unsigned long vm_flags, 507 unsigned long tva_flags, 508 unsigned long orders) 509{ 510 return 0; 511} 512 513#define transparent_hugepage_flags 0UL 514 515#define thp_get_unmapped_area NULL 516 517static inline unsigned long 518thp_get_unmapped_area_vmflags(struct file *filp, unsigned long addr, 519 unsigned long len, unsigned long pgoff, 520 unsigned long flags, vm_flags_t vm_flags) 521{ 522 return 0; 523} 524 525static inline bool 526can_split_folio(struct folio *folio, int caller_pins, int *pextra_pins) 527{ 528 return false; 529} 530static inline int 531split_huge_page_to_list_to_order(struct page *page, struct list_head *list, 532 unsigned int new_order) 533{ 534 return 0; 535} 536static inline int split_huge_page(struct page *page) 537{ 538 return 0; 539} 540 541static inline int split_folio_to_list(struct folio *folio, struct list_head *list) 542{ 543 return 0; 544} 545 546static inline void deferred_split_folio(struct folio *folio, bool partially_mapped) {} 547#define split_huge_pmd(__vma, __pmd, __address) \ 548 do { } while (0) 549 550static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 551 unsigned long address, bool freeze, struct folio *folio) {} 552static inline void split_huge_pmd_address(struct vm_area_struct *vma, 553 unsigned long address, bool freeze, struct folio *folio) {} 554static inline void split_huge_pmd_locked(struct vm_area_struct *vma, 555 unsigned long address, pmd_t *pmd, 556 bool freeze, struct folio *folio) {} 557 558static inline bool unmap_huge_pmd_locked(struct vm_area_struct *vma, 559 unsigned long addr, pmd_t *pmdp, 560 struct folio *folio) 561{ 562 return false; 563} 564 565#define split_huge_pud(__vma, __pmd, __address) \ 566 do { } while (0) 567 568static inline int hugepage_madvise(struct vm_area_struct *vma, 569 unsigned long *vm_flags, int advice) 570{ 571 return -EINVAL; 572} 573 574static inline int madvise_collapse(struct vm_area_struct *vma, 575 struct vm_area_struct **prev, 576 unsigned long start, unsigned long end) 577{ 578 return -EINVAL; 579} 580 581static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, 582 unsigned long start, 583 unsigned long end, 584 long adjust_next) 585{ 586} 587static inline int is_swap_pmd(pmd_t pmd) 588{ 589 return 0; 590} 591static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, 592 struct vm_area_struct *vma) 593{ 594 return NULL; 595} 596static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, 597 struct vm_area_struct *vma) 598{ 599 return NULL; 600} 601 602static inline vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) 603{ 604 return 0; 605} 606 607static inline bool is_huge_zero_folio(const struct folio *folio) 608{ 609 return false; 610} 611 612static inline bool is_huge_zero_pmd(pmd_t pmd) 613{ 614 return false; 615} 616 617static inline void mm_put_huge_zero_folio(struct mm_struct *mm) 618{ 619 return; 620} 621 622static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma, 623 unsigned long addr, pmd_t *pmd, int flags, struct dev_pagemap **pgmap) 624{ 625 return NULL; 626} 627 628static inline bool thp_migration_supported(void) 629{ 630 return false; 631} 632 633static inline int highest_order(unsigned long orders) 634{ 635 return 0; 636} 637 638static inline int next_order(unsigned long *orders, int prev) 639{ 640 return 0; 641} 642 643static inline void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud, 644 unsigned long address) 645{ 646} 647 648static inline int change_huge_pud(struct mmu_gather *tlb, 649 struct vm_area_struct *vma, pud_t *pudp, 650 unsigned long addr, pgprot_t newprot, 651 unsigned long cp_flags) 652{ 653 return 0; 654} 655#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 656 657static inline int split_folio_to_list_to_order(struct folio *folio, 658 struct list_head *list, int new_order) 659{ 660 return split_huge_page_to_list_to_order(&folio->page, list, new_order); 661} 662 663static inline int split_folio_to_order(struct folio *folio, int new_order) 664{ 665 return split_folio_to_list_to_order(folio, NULL, new_order); 666} 667 668#endif /* _LINUX_HUGE_MM_H */