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

core.c

Blame
  • compaction.c 56.36 KiB
    /*
     * linux/mm/compaction.c
     *
     * Memory compaction for the reduction of external fragmentation. Note that
     * this heavily depends upon page migration to do all the real heavy
     * lifting
     *
     * Copyright IBM Corp. 2007-2010 Mel Gorman <mel@csn.ul.ie>
     */
    #include <linux/cpu.h>
    #include <linux/swap.h>
    #include <linux/migrate.h>
    #include <linux/compaction.h>
    #include <linux/mm_inline.h>
    #include <linux/backing-dev.h>
    #include <linux/sysctl.h>
    #include <linux/sysfs.h>
    #include <linux/page-isolation.h>
    #include <linux/kasan.h>
    #include <linux/kthread.h>
    #include <linux/freezer.h>
    #include <linux/page_owner.h>
    #include "internal.h"
    
    #ifdef CONFIG_COMPACTION
    static inline void count_compact_event(enum vm_event_item item)
    {
    	count_vm_event(item);
    }
    
    static inline void count_compact_events(enum vm_event_item item, long delta)
    {
    	count_vm_events(item, delta);
    }
    #else
    #define count_compact_event(item) do { } while (0)
    #define count_compact_events(item, delta) do { } while (0)
    #endif
    
    #if defined CONFIG_COMPACTION || defined CONFIG_CMA
    
    #define CREATE_TRACE_POINTS
    #include <trace/events/compaction.h>
    
    #define block_start_pfn(pfn, order)	round_down(pfn, 1UL << (order))
    #define block_end_pfn(pfn, order)	ALIGN((pfn) + 1, 1UL << (order))
    #define pageblock_start_pfn(pfn)	block_start_pfn(pfn, pageblock_order)
    #define pageblock_end_pfn(pfn)		block_end_pfn(pfn, pageblock_order)
    
    static unsigned long release_freepages(struct list_head *freelist)
    {
    	struct page *page, *next;
    	unsigned long high_pfn = 0;
    
    	list_for_each_entry_safe(page, next, freelist, lru) {
    		unsigned long pfn = page_to_pfn(page);
    		list_del(&page->lru);
    		__free_page(page);
    		if (pfn > high_pfn)
    			high_pfn = pfn;
    	}
    
    	return high_pfn;
    }
    
    static void map_pages(struct list_head *list)
    {
    	unsigned int i, order, nr_pages;
    	struct page *page, *next;
    	LIST_HEAD(tmp_list);