Skip to content
Snippets Groups Projects
Select Git revision
  • 4ef873226ceb9c7bf11a922caddc5698a24bcfaf
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

vm_fault.c

Blame
    • Peter Xu's avatar
      4ef87322
      mm: introduce fault_signal_pending() · 4ef87322
      Peter Xu authored
      For most architectures, we've got a quick path to detect fatal signal
      after a handle_mm_fault().  Introduce a helper for that quick path.
      
      It cleans the current codes a bit so we don't need to duplicate the same
      check across archs.  More importantly, this will be an unified place that
      we handle the signal immediately right after an interrupted page fault, so
      it'll be much easier for us if we want to change the behavior of handling
      signals later on for all the archs.
      
      Note that currently only part of the archs are using this new helper,
      because some archs have their own way to handle signals.  In the follow up
      patches, we'll try to apply this helper to all the rest of archs.
      
      Another note is that the "regs" parameter in the new helper is not used
      yet.  It'll be used very soon.  Now we kept it in this patch only to avoid
      touching all the archs again in the follow up patches.
      
      [peterx@redhat.com: fix sparse warnings]
        Link: http://lkml.kernel.org/r/20200311145921.GD479302@xz-x1
      
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Tested-by: default avatarBrian Geffon <bgeffon@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Bobby Powers <bobbypowers@gmail.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
      Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "Kirill A . Shutemov" <kirill@shutemov.name>
      Cc: Martin Cracauer <cracauer@cons.org>
      Cc: Marty McFadden <mcfadden8@llnl.gov>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Maya Gokhale <gokhale2@llnl.gov>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Pavel Emelyanov <xemul@openvz.org>
      Link: http://lkml.kernel.org/r/20200220155353.8676-4-peterx@redhat.com
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4ef87322
      History
      mm: introduce fault_signal_pending()
      Peter Xu authored
      For most architectures, we've got a quick path to detect fatal signal
      after a handle_mm_fault().  Introduce a helper for that quick path.
      
      It cleans the current codes a bit so we don't need to duplicate the same
      check across archs.  More importantly, this will be an unified place that
      we handle the signal immediately right after an interrupted page fault, so
      it'll be much easier for us if we want to change the behavior of handling
      signals later on for all the archs.
      
      Note that currently only part of the archs are using this new helper,
      because some archs have their own way to handle signals.  In the follow up
      patches, we'll try to apply this helper to all the rest of archs.
      
      Another note is that the "regs" parameter in the new helper is not used
      yet.  It'll be used very soon.  Now we kept it in this patch only to avoid
      touching all the archs again in the follow up patches.
      
      [peterx@redhat.com: fix sparse warnings]
        Link: http://lkml.kernel.org/r/20200311145921.GD479302@xz-x1
      
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Tested-by: default avatarBrian Geffon <bgeffon@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Bobby Powers <bobbypowers@gmail.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
      Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "Kirill A . Shutemov" <kirill@shutemov.name>
      Cc: Martin Cracauer <cracauer@cons.org>
      Cc: Marty McFadden <mcfadden8@llnl.gov>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Maya Gokhale <gokhale2@llnl.gov>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Pavel Emelyanov <xemul@openvz.org>
      Link: http://lkml.kernel.org/r/20200220155353.8676-4-peterx@redhat.com
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    huge_memory.c 76.01 KiB
    /*
     *  Copyright (C) 2009  Red Hat, Inc.
     *
     *  This work is licensed under the terms of the GNU GPL, version 2. See
     *  the COPYING file in the top-level directory.
     */
    
    #include <linux/mm.h>
    #include <linux/sched.h>
    #include <linux/highmem.h>
    #include <linux/hugetlb.h>
    #include <linux/mmu_notifier.h>
    #include <linux/rmap.h>
    #include <linux/swap.h>
    #include <linux/shrinker.h>
    #include <linux/mm_inline.h>
    #include <linux/kthread.h>
    #include <linux/khugepaged.h>
    #include <linux/freezer.h>
    #include <linux/mman.h>
    #include <linux/pagemap.h>
    #include <linux/migrate.h>
    #include <linux/hashtable.h>
    
    #include <asm/tlb.h>
    #include <asm/pgalloc.h>
    #include "internal.h"
    
    /*
     * By default transparent hugepage support is disabled in order that avoid
     * to risk increase the memory footprint of applications without a guaranteed
     * benefit. When transparent hugepage support is enabled, is for all mappings,
     * and khugepaged scans all mappings.
     * Defrag is invoked by khugepaged hugepage allocations and by page faults
     * for all hugepage allocations.
     */
    unsigned long transparent_hugepage_flags __read_mostly =
    #ifdef CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS
    	(1<<TRANSPARENT_HUGEPAGE_FLAG)|
    #endif
    #ifdef CONFIG_TRANSPARENT_HUGEPAGE_MADVISE
    	(1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG)|
    #endif
    	(1<<TRANSPARENT_HUGEPAGE_DEFRAG_FLAG)|
    	(1<<TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG)|
    	(1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG);
    
    /* default scan 8*512 pte (or vmas) every 30 second */
    static unsigned int khugepaged_pages_to_scan __read_mostly = HPAGE_PMD_NR*8;
    static unsigned int khugepaged_pages_collapsed;
    static unsigned int khugepaged_full_scans;
    static unsigned int khugepaged_scan_sleep_millisecs __read_mostly = 10000;
    /* during fragmentation poll the hugepage allocator once every minute */
    static unsigned int khugepaged_alloc_sleep_millisecs __read_mostly = 60000;
    static struct task_struct *khugepaged_thread __read_mostly;
    static DEFINE_MUTEX(khugepaged_mutex);
    static DEFINE_SPINLOCK(khugepaged_mm_lock);
    static DECLARE_WAIT_QUEUE_HEAD(khugepaged_wait);
    /*
     * default collapse hugepages if there is at least one pte mapped like
     * it would have happened if the vma was large enough during page
     * fault.
     */
    static unsigned int khugepaged_max_ptes_none __read_mostly = HPAGE_PMD_NR-1;
    
    static int khugepaged(void *none);
    static int khugepaged_slab_init(void);
    
    #define MM_SLOTS_HASH_BITS 10
    static __read_mostly DEFINE_HASHTABLE(mm_slots_hash, MM_SLOTS_HASH_BITS);