mm-add-unmap_mapping_pages.patch removed from -mm tree
The patch titled
Subject: mm: add unmap_mapping_pages()
has been removed from the -mm tree. Its filename was
mm-add-unmap_mapping_pages.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Matthew Wilcox <[email protected]>
Subject: mm: add unmap_mapping_pages()
Several users of unmap_mapping_range() would prefer to express their range in pages rather than bytes. Unfortuately, on a 32-bit kernel, you have to remember to cast your page number to a 64-bit type before shifting it, and four places in the current tree didn't remember to do that. That's a sign of a bad interface.
Conveniently, unmap_mapping_range() actually converts from bytes into pages, so hoist the guts of unmap_mapping_range() into a new function unmap_mapping_pages() and convert the callers which want to use pages.
---
fs/dax.c | 19 ++++++------------- include/linux/mm.h | 26 ++++++++++++++++---------- mm/khugepaged.c | 3 +-- mm/memory.c | 43 +++++++++++++++++++++++++++++++------------ mm/nommu.c | 7 ------- mm/truncate.c | 23 +++++++---------------- 6 files changed, 61 insertions(+), 60 deletions(-)
fs/dax.c renamed from fs/dax.c~mm-add-unmap_mapping_pages +6 -13
@@ -44,6 +44,7 @@/* The 'colour' (ie low bits) within a PMD of a page offset. */ #define PG_PMD_COLOUR ((PMD_SIZE >> PAGE_SHIFT) - 1) +#define PG_PMD_NR (PMD_SIZE >> PAGE_SHIFT)static wait_queue_head_t wait_table[DAX_WAIT_TABLE_ENTRIES ];
@@ -375,8 +376,8 @@ restart:* unmapped. */ if (pmd_downgrade &&dax_is_zero_entry (entry)) -unmap_mapping_range (mapping, - (index <<PAGE_SHIFT ) &PMD_MASK ,PMD_SIZE ,0 ); +unmap_mapping_pages (mapping, index & ~PG_PMD_COLOUR , +PG_PMD_NR , false); err =radix_tree_preload (mapping_gfp_mask (mapping) & ~__GFP_HIGHMEM);
@@ -538,12 +539,10 @@ static void *dax_insert_mapping_entry(stif (dax_is_zero_entry (entry) && !(flags &RADIX_DAX_ZERO_PAGE )) {/* we are replacing a zero page with block mapping */ if (dax_is_pmd_entry (entry)) -unmap_mapping_range (mapping, - (vmf->pgoff <<PAGE_SHIFT ) &PMD_MASK , -PMD_SIZE ,0 ); +unmap_mapping_pages (mapping, index & ~PG_PMD_COLOUR , +PG_PMD_NR , false);else /* pte entry */ -unmap_mapping_range (mapping, vmf->pgoff <<PAGE_SHIFT , -PAGE_SIZE ,0 ); +unmap_mapping_pages (mapping, vmf->pgoff,1 , false); }spin_lock_irq (&mapping->tree_lock);
@@ -1269,12 +1268,6 @@ static int dax_iomap_pte_fault(struct vm }#ifdef CONFIG_FS_DAX_PMD -/* -* The 'colour' (ie low bits) within a PMD of a page offset. This comes up -* more often than one might expect in the below functions. -*/ -#define PG_PMD_COLOUR ((PMD_SIZE >> PAGE_SHIFT) - 1) -static int dax_pmd_load_hole (struct vm_fault *vmf,struct iomap *iomap,void *entry) {
include/linux/mm.h renamed from include/linux/mm.h~mm-add-unmap_mapping_pages +16 -10
@@ -1312,8 +1312,6 @@ void free_pgd_range(struct mmu_gather *t unsigned long end, unsigned long floor, unsigned long ceiling);int copy_page_range (struct mm_struct *dst,struct mm_struct *src,struct vm_area_struct *vma); -void unmap_mapping_range (struct address_space *mapping, -loff_t const holebegin,loff_t const holelen,int even_cows);int follow_pte_pmd (struct mm_struct *mm,unsigned long address,unsigned long *start,unsigned long *end,pte_t **ptepp,pmd_t **pmdpp,spinlock_t **ptlp);
@@ -1324,12 +1322,6 @@ int follow_phys(struct vm_area_struct *vint generic_access_phys (struct vm_area_struct *vma,unsigned long addr,void *buf,int len,int write); -static inline void unmap_shared_mapping_range (struct address_space *mapping, -loff_t const holebegin,loff_t const holelen) -{ -unmap_mapping_range (mapping, holebegin, holelen,0 ); -} -extern void truncate_pagecache (struct inode *inode,loff_t new);extern void truncate_setsize (struct inode *inode,loff_t newsize);void pagecache_isize_extended (struct inode *inode,loff_t from,loff_t to);
@@ -1344,6 +1336,10 @@ extern int handle_mm_fault(struct vm_areextern int fixup_user_fault (struct task_struct *tsk,struct mm_struct *mm,unsigned long address,unsigned int fault_flags,bool *unlocked); +void unmap_mapping_pages (struct address_space *mapping, +pgoff_t start,pgoff_t nr,bool even_cows); +void unmap_mapping_range (struct address_space *mapping, +loff_t const holebegin,loff_t const holelen,int even_cows);#else static inline int handle_mm_fault (struct vm_area_struct *vma,unsigned long address,unsigned int flags)
@@ -1360,10 +1356,20 @@ static inline int fixup_user_fault(strucBUG ();return -EFAULT ; } +static inline void unmap_mapping_pages (struct address_space *mapping, +pgoff_t start,pgoff_t nr,bool even_cows) { } +static inline void unmap_mapping_range (struct address_space *mapping, +loff_t const holebegin,loff_t const holelen,int even_cows) { }#endif -extern int access_process_vm (struct task_struct *tsk,unsigned long addr,void *buf,int len, -unsigned int gup_flags); +static inline void unmap_shared_mapping_range (struct address_space *mapping, +loff_t const holebegin,loff_t const holelen) +{ +unmap_mapping_range (mapping, holebegin, holelen,0 ); +} + +extern int access_process_vm (struct task_struct *tsk,unsigned long addr, +void *buf,int len,unsigned int gup_flags);extern int access_remote_vm (struct mm_struct *mm,unsigned long addr,void *buf,int len,unsigned int gup_flags); extern int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
mm/khugepaged.c renamed from mm/khugepaged.c~mm-add-unmap_mapping_pages +1 -2
@@ -1399,8 +1399,7 @@ static void collapse_shmem(struct mm_str }if (page_mapped (page)) -unmap_mapping_range (mapping, index <<PAGE_SHIFT , -PAGE_SIZE ,0 ); +unmap_mapping_pages (mapping, index,1 , false);spin_lock_irq (&mapping->tree_lock);
mm/memory.c renamed from mm/memory.c~mm-add-unmap_mapping_pages +31 -12
62 lines not on this page · raw message
mm/nommu.c renamed from mm/nommu.c~mm-add-unmap_mapping_pages +0 -7
@@ -1788,13 +1788,6 @@ unsigned long arch_get_unmapped_area(strreturn -ENOMEM ; } -void unmap_mapping_range (struct address_space *mapping, -loff_t const holebegin,loff_t const holelen, -int even_cows) -{ -} -EXPORT_SYMBOL (unmap_mapping_range); -int filemap_fault (struct vm_fault *vmf) {BUG ();
mm/truncate.c renamed from mm/truncate.c~mm-add-unmap_mapping_pages +7 -16
@@ -179,12 +179,8 @@ static void truncate_cleanup_page(struct address_space *mapping, struct page *page) { if (page_mapped(page)) { - loff_t holelen; - - holelen =PageTransHuge (page) ?HPAGE_PMD_SIZE :PAGE_SIZE ; -unmap_mapping_range (mapping, - (loff_t )page->index <<PAGE_SHIFT , - holelen,0 ); + pgoff_t nr = PageTransHuge(page) ? HPAGE_PMD_NR : 1; +unmap_mapping_pages (mapping, page->index, nr, false); }if (page_has_private (page))
@@ -715,19 +711,15 @@ int invalidate_inode_pages2_range(struct/* * Zap the rest of the file in one hit. */ -unmap_mapping_range (mapping, - (loff_t )index <<PAGE_SHIFT , - (loff_t)(1 + end - index) - <<PAGE_SHIFT , -0 ); +unmap_mapping_pages (mapping, index, + (1 + end - index), false); did_range_unmap =1 ; }else {/* * Just zap this page */ -unmap_mapping_range (mapping, - (loff_t )index <<PAGE_SHIFT , -PAGE_SIZE ,0 ); +unmap_mapping_pages (mapping, index, +1 , false); } }BUG_ON (page_mapped (page));
@@ -753,8 +745,7 @@ int invalidate_inode_pages2_range(struct* get remapped later. */ if (dax_mapping (mapping)) { -unmap_mapping_range (mapping, (loff_t )start <<PAGE_SHIFT , - (loff_t)(end - start +1 ) <<PAGE_SHIFT ,0 ); +unmap_mapping_pages (mapping, start, end - start +1 , false); } out:cleancache_invalidate_inode (mapping);
_
Patches currently in -mm which might be from [email protected] are