mm: drop zap_details::ignore_dirty
Subsystems (10)
PATCH RESEND 1/4 mm: drop zap_details::ignore_dirty
The only user of ignore_dirty is oom-reaper. But it doesn't really use it.
ignore_dirty only has effect on file pages mapped with dirty pte. But oom-repear skips shared VMAs, so there's no way we can dirty file pte in them.
--- include/linux/mm.h | 1 - mm/memory.c | 6 ------ mm/oom_kill.c | 3 +-- 3 files changed, 1 insertion(+), 9 deletions(-)
include/linux/mm.h +0 -1
@@ -1148,7 +1148,6 @@ struct zap_details {struct address_space *check_mapping;/* Check page->mapping if set */ pgoff_t first_index;/* Lowest page->index to unmap */ pgoff_t last_index;/* Highest page->index to unmap */ -bool ignore_dirty;/* Ignore dirty pages */ bool check_swap_entries;/* Check also swap entries */ };
mm/memory.c +0 -6
@@ -1155,12 +1155,6 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,if (!PageAnon (page)) {if (pte_dirty (ptent)) { -/* -* oom_reaper cannot tear down dirty -* pages -*/ -if (unlikely (details && details->ignore_dirty)) -continue ; force_flush =1 ;set_page_dirty (page); }
mm/oom_kill.c +1 -2
@@ -465,8 +465,7 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm) {struct mmu_gather tlb;struct vm_area_struct *vma; -struct zap_details details = {.check_swap_entries = true, - .ignore_dirty = true}; +struct zap_details details = {.check_swap_entries = true};bool ret = true;/*
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH RESEND 2/4 mm: drop zap_details::check_swap_entries
detail == NULL would give the same functionality as .check_swap_entries==true.
--- include/linux/mm.h | 1 - mm/memory.c | 4 ++-- mm/oom_kill.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-)
include/linux/mm.h +0 -1
@@ -1148,7 +1148,6 @@ struct zap_details {struct address_space *check_mapping;/* Check page->mapping if set */ pgoff_t first_index;/* Lowest page->index to unmap */ pgoff_t last_index;/* Highest page->index to unmap */ -bool check_swap_entries;/* Check also swap entries */ }; struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
mm/memory.c +2 -2
@@ -1173,8 +1173,8 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, }continue ; } -/* only check swap_entries if explicitly asked for in details */ -if (unlikely (details && !details->check_swap_entries)) +/* If details->check_mapping, we leave swap entries. */ +if (unlikely (details))continue ; entry =pte_to_swp_entry (ptent);
mm/oom_kill.c +1 -2
@@ -465,7 +465,6 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm) {struct mmu_gather tlb;struct vm_area_struct *vma; -struct zap_details details = {.check_swap_entries = true};bool ret = true;/*
@@ -531,7 +530,7 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)*/ if (vma_is_anonymous (vma) || !(vma->vm_flags &VM_SHARED ))unmap_page_range (&tlb, vma, vma->vm_start, vma->vm_end, - &details); +NULL ); }tlb_finish_mmu (&tlb,0 ,-1 ); pr_info("oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n",
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH RESEND 3/4 mm: drop unused argument of zap_page_range()
In reply to Kirill A. ShutemovThere's no users of zap_page_range() who wants non-NULL 'details'. Let's drop it.
--- arch/s390/mm/gmap.c | 2 +- arch/x86/mm/mpx.c | 2 +- drivers/android/binder.c | 2 +- drivers/staging/android/ion/ion.c | 3 +-- include/linux/mm.h | 2 +- mm/madvise.c | 2 +- mm/memory.c | 5 ++--- 7 files changed, 8 insertions(+), 10 deletions(-)
arch/s390/mm/gmap.c +1 -1
@@ -687,7 +687,7 @@ void gmap_discard(struct gmap *gmap, unsigned long from, unsigned long to)/* Find vma in the parent mm */ vma =find_vma (gmap->mm, vmaddr); size =min (to - gaddr,PMD_SIZE - (gaddr & ~PMD_MASK )); -zap_page_range (vma, vmaddr, size,NULL ); +zap_page_range (vma, vmaddr, size); }up_read (&gmap->mm->mmap_sem); }
arch/x86/mm/mpx.c +1 -1
@@ -796,7 +796,7 @@ static noinline int zap_bt_entries_mapping(struct mm_struct *mm,return -EINVAL ; len =min (vma->vm_end, end) - addr; -zap_page_range (vma, addr, len,NULL ); +zap_page_range (vma, addr, len);trace_mpx_unmap_zap (addr, addr+len); vma = vma->vm_next;
drivers/android/binder.c +1 -1
@@ -629,7 +629,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, page = &proc->pages[(page_addr - proc->buffer) /PAGE_SIZE ];if (vma)zap_page_range (vma, (uintptr_t )page_addr + - proc->user_buffer_offset,PAGE_SIZE ,NULL ); + proc->user_buffer_offset,PAGE_SIZE ); err_vm_insert_page_failed:unmap_kernel_range ((unsigned long )page_addr,PAGE_SIZE ); err_map_kernel_failed:
drivers/staging/android/ion/ion.c +1 -2
@@ -865,8 +865,7 @@ static void ion_buffer_sync_for_device(struct ion_buffer *buffer,list_for_each_entry (vma_list, &buffer->vmas, list) {struct vm_area_struct *vma = vma_list->vma; -zap_page_range (vma, vma->vm_start, vma->vm_end - vma->vm_start, -NULL ); +zap_page_range (vma, vma->vm_start, vma->vm_end - vma->vm_start); }mutex_unlock (&buffer->lock); }
include/linux/mm.h +1 -1
@@ -1158,7 +1158,7 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,int zap_vma_ptes (struct vm_area_struct *vma,unsigned long address,unsigned long size);void zap_page_range (struct vm_area_struct *vma,unsigned long address, -unsigned long size,struct zap_details *); +unsigned long size);void unmap_vmas (struct mmu_gather *tlb,struct vm_area_struct *start_vma,unsigned long start,unsigned long end);
mm/madvise.c +1 -1
@@ -476,7 +476,7 @@ static long madvise_dontneed(struct vm_area_struct *vma,if (vma->vm_flags & (VM_LOCKED |VM_HUGETLB |VM_PFNMAP ))return -EINVAL ; -zap_page_range (vma, start, end - start,NULL ); +zap_page_range (vma, start, end - start);return 0 ; }
mm/memory.c +2 -3
@@ -1370,12 +1370,11 @@ void unmap_vmas(struct mmu_gather *tlb,* @vma: vm_area_struct holding the applicable pages * @start: starting address of pages to zap * @size: number of bytes to zap -* @details: details of shared cache invalidation * * Caller must protect the VMA list */ void zap_page_range (struct vm_area_struct *vma,unsigned long start, -unsigned long size,struct zap_details *details) +unsigned long size) {struct mm_struct *mm = vma->vm_mm;struct mmu_gather tlb;
@@ -1386,7 +1385,7 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long start,update_hiwater_rss (mm);mmu_notifier_invalidate_range_start (mm, start, end);for ( ; vma && vma->vm_start < end; vma = vma->vm_next) -unmap_single_vma (&tlb, vma, start, end, details); +unmap_single_vma (&tlb, vma, start, end,NULL );mmu_notifier_invalidate_range_end (mm, start, end);tlb_finish_mmu (&tlb, start, end); }
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH RESEND 4/4 oom-reaper: use madvise_dontneed() logic to decide if unmap the VMA
In reply to Kirill A. ShutemovLogic on whether we can reap pages from the VMA should match what we have in madvise_dontneed(). In particular, we should skip, VM_PFNMAP VMAs, but we don't now.
Let's just extract condition on which we can shoot down pagesi from a VMA with MADV_DONTNEED into separate function and use it in both places.
--- mm/internal.h | 5 +++++ mm/madvise.c | 4 +++- mm/oom_kill.c | 9 +-------- 3 files changed, 9 insertions(+), 9 deletions(-)
mm/internal.h +5 -0
@@ -43,6 +43,11 @@ int do_swap_page(struct vm_fault *vmf);void free_pgtables (struct mmu_gather *tlb,struct vm_area_struct *start_vma,unsigned long floor,unsigned long ceiling); +static inline bool can_madv_dontneed_vma (struct vm_area_struct *vma) +{ +return !(vma->vm_flags & (VM_LOCKED |VM_HUGETLB |VM_PFNMAP )); +} + void unmap_page_range(struct mmu_gather *tlb, struct vm_area_struct *vma, unsigned long addr, unsigned long end,
mm/madvise.c +3 -1
@@ -24,6 +24,8 @@#include <asm/tlb.h> +#include "internal.h" +/* * Any behaviour which results in changes to the vma->vm_flags needs to * take mmap_sem for writing. Others, which simply traverse vmas, need
@@ -473,7 +475,7 @@ static long madvise_dontneed(struct vm_area_struct *vma, unsigned long start, unsigned long end) { *prev = vma; -if (vma->vm_flags & (VM_LOCKED |VM_HUGETLB |VM_PFNMAP )) +if (!can_madv_dontneed_vma (vma))return -EINVAL ;zap_page_range (vma, start, end - start);
mm/oom_kill.c +1 -8
@@ -508,14 +508,7 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)tlb_gather_mmu (&tlb, mm,0 ,-1 );for (vma = mm->mmap ; vma; vma = vma->vm_next) { -if (is_vm_hugetlb_page (vma)) -continue ; - -/* -* mlocked VMAs require explicit munlocking before unmap. -* Let's keep it simple here and skip such VMAs. -*/ -if (vma->vm_flags &VM_LOCKED ) +if (!can_madv_dontneed_vma (vma))continue ;/*
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>