shmem.c (c845428b7a9157523103100806bc8130d64769c8) | shmem.c (93893eacb372b0a4a30f7de6609b08c3ba6c4fd9) |
---|---|
1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 521 unchanged lines hidden (view full) --- 530#define SHMEM_HUGE_DENY (-1) 531#define SHMEM_HUGE_FORCE (-2) 532 533#ifdef CONFIG_TRANSPARENT_HUGEPAGE 534/* ifdef here to avoid bloating shmem.o when not necessary */ 535 536static int shmem_huge __read_mostly = SHMEM_HUGE_NEVER; 537 | 1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 521 unchanged lines hidden (view full) --- 530#define SHMEM_HUGE_DENY (-1) 531#define SHMEM_HUGE_FORCE (-2) 532 533#ifdef CONFIG_TRANSPARENT_HUGEPAGE 534/* ifdef here to avoid bloating shmem.o when not necessary */ 535 536static int shmem_huge __read_mostly = SHMEM_HUGE_NEVER; 537 |
538bool shmem_is_huge(struct inode *inode, pgoff_t index, bool shmem_huge_force, 539 struct mm_struct *mm, unsigned long vm_flags) | 538static bool __shmem_is_huge(struct inode *inode, pgoff_t index, 539 bool shmem_huge_force, struct mm_struct *mm, 540 unsigned long vm_flags) |
540{ 541 loff_t i_size; 542 543 if (!S_ISREG(inode->i_mode)) 544 return false; 545 if (mm && ((vm_flags & VM_NOHUGEPAGE) || test_bit(MMF_DISABLE_THP, &mm->flags))) 546 return false; 547 if (shmem_huge == SHMEM_HUGE_DENY) --- 14 unchanged lines hidden (view full) --- 562 if (mm && (vm_flags & VM_HUGEPAGE)) 563 return true; 564 fallthrough; 565 default: 566 return false; 567 } 568} 569 | 541{ 542 loff_t i_size; 543 544 if (!S_ISREG(inode->i_mode)) 545 return false; 546 if (mm && ((vm_flags & VM_NOHUGEPAGE) || test_bit(MMF_DISABLE_THP, &mm->flags))) 547 return false; 548 if (shmem_huge == SHMEM_HUGE_DENY) --- 14 unchanged lines hidden (view full) --- 563 if (mm && (vm_flags & VM_HUGEPAGE)) 564 return true; 565 fallthrough; 566 default: 567 return false; 568 } 569} 570 |
571bool shmem_is_huge(struct inode *inode, pgoff_t index, 572 bool shmem_huge_force, struct mm_struct *mm, 573 unsigned long vm_flags) 574{ 575 if (HPAGE_PMD_ORDER > MAX_PAGECACHE_ORDER) 576 return false; 577 578 return __shmem_is_huge(inode, index, shmem_huge_force, mm, vm_flags); 579} 580 |
|
570#if defined(CONFIG_SYSFS) 571static int shmem_parse_huge(const char *str) 572{ 573 if (!strcmp(str, "never")) 574 return SHMEM_HUGE_NEVER; 575 if (!strcmp(str, "always")) 576 return SHMEM_HUGE_ALWAYS; 577 if (!strcmp(str, "within_size")) --- 4366 unchanged lines hidden --- | 581#if defined(CONFIG_SYSFS) 582static int shmem_parse_huge(const char *str) 583{ 584 if (!strcmp(str, "never")) 585 return SHMEM_HUGE_NEVER; 586 if (!strcmp(str, "always")) 587 return SHMEM_HUGE_ALWAYS; 588 if (!strcmp(str, "within_size")) --- 4366 unchanged lines hidden --- |