Skip to content

Commit b2bd53f

Browse files
MiaoheLintorvalds
authored andcommitted
mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK
Patch series "Cleanup and fixup for huge_memory:, v3. This series contains cleanups to remove dedicated macro and remove unnecessary tlb_remove_page_size() for huge zero pmd. Also this adds missing read-only THP checking for transparent_hugepage_enabled() and avoids discarding hugepage if other processes are mapping it. More details can be found in the respective changelogs. Thi patch (of 5): Rewrite the pgoff checking logic to remove macro HPAGE_CACHE_INDEX_MASK which is only used here to simplify the code. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Miaohe Lin <[email protected]> Reviewed-by: Yang Shi <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Zi Yan <[email protected]> Cc: William Kucharski <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: "Aneesh Kumar K . V" <[email protected]> Cc: Ralph Campbell <[email protected]> Cc: Song Liu <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Mike Kravetz <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent b593b90 commit b2bd53f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

include/linux/huge_mm.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,13 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
152152

153153
bool transparent_hugepage_enabled(struct vm_area_struct *vma);
154154

155-
#define HPAGE_CACHE_INDEX_MASK (HPAGE_PMD_NR - 1)
156-
157155
static inline bool transhuge_vma_suitable(struct vm_area_struct *vma,
158156
unsigned long haddr)
159157
{
160158
/* Don't have to check pgoff for anonymous vma */
161159
if (!vma_is_anonymous(vma)) {
162-
if (((vma->vm_start >> PAGE_SHIFT) & HPAGE_CACHE_INDEX_MASK) !=
163-
(vma->vm_pgoff & HPAGE_CACHE_INDEX_MASK))
160+
if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
161+
HPAGE_PMD_NR))
164162
return false;
165163
}
166164

0 commit comments

Comments
 (0)