diff options
Diffstat (limited to 'mm/internal.h')
| -rw-r--r-- | mm/internal.h | 34 | 
1 files changed, 30 insertions, 4 deletions
diff --git a/mm/internal.h b/mm/internal.h index 3cf20ab3ca01..b5634e78f01d 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -63,6 +63,29 @@ static inline unsigned long ra_submit(struct file_ra_state *ra,  					ra->start, ra->size, ra->async_size);  } +/** + * page_evictable - test whether a page is evictable + * @page: the page to test + * + * Test whether page is evictable--i.e., should be placed on active/inactive + * lists vs unevictable list. + * + * Reasons page might not be evictable: + * (1) page's mapping marked unevictable + * (2) page is part of an mlocked VMA + * + */ +static inline bool page_evictable(struct page *page) +{ +	bool ret; + +	/* Prevent address_space of inode and swap cache from being freed */ +	rcu_read_lock(); +	ret = !mapping_unevictable(page_mapping(page)) && !PageMlocked(page); +	rcu_read_unlock(); +	return ret; +} +  /*   * Turn a non-refcounted page (->_refcount == 0) into refcounted with   * a count of one. @@ -157,6 +180,8 @@ static inline struct page *pageblock_pfn_to_page(unsigned long start_pfn,  }  extern int __isolate_free_page(struct page *page, unsigned int order); +extern void __putback_isolated_page(struct page *page, unsigned int order, +				    int mt);  extern void memblock_free_pages(struct page *page, unsigned long pfn,  					unsigned int order);  extern void __free_pages_core(struct page *page, unsigned int order); @@ -206,6 +231,7 @@ struct compact_control {  	bool whole_zone;		/* Whole zone should/has been scanned */  	bool contended;			/* Signal lock or sched contention */  	bool rescan;			/* Rescanning the same pageblock */ +	bool alloc_contig;		/* alloc_contig_range allocation */  };  /* @@ -377,10 +403,10 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf,  	/*  	 * FAULT_FLAG_RETRY_NOWAIT means we don't want to wait on page locks or  	 * anything, so we only pin the file and drop the mmap_sem if only -	 * FAULT_FLAG_ALLOW_RETRY is set. +	 * FAULT_FLAG_ALLOW_RETRY is set, while this is the first attempt.  	 */ -	if ((flags & (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT)) == -	    FAULT_FLAG_ALLOW_RETRY) { +	if (fault_flag_allow_retry_first(flags) && +	    !(flags & FAULT_FLAG_RETRY_NOWAIT)) {  		fpin = get_file(vmf->vma->vm_file);  		up_read(&vmf->vma->vm_mm->mmap_sem);  	} @@ -532,7 +558,7 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone,  #else  #define ALLOC_NOFRAGMENT	  0x0  #endif -#define ALLOC_KSWAPD		0x200 /* allow waking of kswapd */ +#define ALLOC_KSWAPD		0x800 /* allow waking of kswapd, __GFP_KSWAPD_RECLAIM set */  enum ttu_flags;  struct tlbflush_unmap_batch;  |