Skip to content
Snippets Groups Projects
Select Git revision
  • ae7efa507dee4813ec4bcdadebeec191e247d0c9
  • 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

huge_memory.c

Blame
  • huge_memory.c 79.18 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.
     */
    
    #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
    
    #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);
    static void khugepaged_slab_exit(void);