mm: swap: unify cluster-based and vma-based swap readahead
This patch makes do_swap_page() not need to be aware of two different swap readahead algorithms. Just unify cluster-based and vma-based readahead function call. Link: http://lkml.kernel.org/r/1509520520-32367-3-git-send-email-minchan@kernel.org Link: http://lkml.kernel.org/r/20180220085249.151400-3-minchan@kernel.org Signed-off-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Hugh Dickins <hughd@google.com> Cc: Huang Ying <ying.huang@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
eaf649ebc3
commit
e9e9b7ecee
@@ -400,7 +400,6 @@ int generic_swapfile_activate(struct swap_info_struct *, struct file *,
|
||||
#define SWAP_ADDRESS_SPACE_SHIFT 14
|
||||
#define SWAP_ADDRESS_SPACE_PAGES (1 << SWAP_ADDRESS_SPACE_SHIFT)
|
||||
extern struct address_space *swapper_spaces[];
|
||||
extern bool swap_vma_readahead;
|
||||
#define swap_address_space(entry) \
|
||||
(&swapper_spaces[swp_type(entry)][swp_offset(entry) \
|
||||
>> SWAP_ADDRESS_SPACE_SHIFT])
|
||||
@@ -422,10 +421,10 @@ extern struct page *read_swap_cache_async(swp_entry_t, gfp_t,
|
||||
extern struct page *__read_swap_cache_async(swp_entry_t, gfp_t,
|
||||
struct vm_area_struct *vma, unsigned long addr,
|
||||
bool *new_page_allocated);
|
||||
extern struct page *swapin_readahead(swp_entry_t, gfp_t,
|
||||
struct vm_area_struct *vma, unsigned long addr);
|
||||
extern struct page *do_swap_page_readahead(swp_entry_t fentry, gfp_t gfp_mask,
|
||||
struct vm_fault *vmf);
|
||||
extern struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t flag,
|
||||
struct vm_fault *vmf);
|
||||
extern struct page *swapin_readahead(swp_entry_t entry, gfp_t flag,
|
||||
struct vm_fault *vmf);
|
||||
|
||||
/* linux/mm/swapfile.c */
|
||||
extern atomic_long_t nr_swap_pages;
|
||||
@@ -433,11 +432,6 @@ extern long total_swap_pages;
|
||||
extern atomic_t nr_rotate_swap;
|
||||
extern bool has_usable_swap(void);
|
||||
|
||||
static inline bool swap_use_vma_readahead(void)
|
||||
{
|
||||
return READ_ONCE(swap_vma_readahead) && !atomic_read(&nr_rotate_swap);
|
||||
}
|
||||
|
||||
/* Swap 50% full? Release swapcache more aggressively.. */
|
||||
static inline bool vm_swap_full(void)
|
||||
{
|
||||
@@ -533,19 +527,14 @@ static inline void put_swap_page(struct page *page, swp_entry_t swp)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
|
||||
struct vm_area_struct *vma, unsigned long addr)
|
||||
static inline struct page *swap_cluster_readahead(swp_entry_t entry,
|
||||
gfp_t gfp_mask, struct vm_fault *vmf)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool swap_use_vma_readahead(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline struct page *do_swap_page_readahead(swp_entry_t fentry,
|
||||
gfp_t gfp_mask, struct vm_fault *vmf)
|
||||
static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
|
||||
struct vm_fault *vmf)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user