mm/swap: skip readahead for unreferenced swap slots
Subsystems (2)
[email protected]
maintainerPATCH 115/142 mm/swap: skip readahead for unreferenced swap slots
From: Tim Chen <[email protected]>
Subject: mm/swap: skip readahead for unreferenced swap slots
We can avoid needlessly allocating page for swap slots that are not used by anyone. No pages have to be read in for these slots.
Link http://lkml.kernel.org/r/0784b3f20b9bd3aa5552219624cb78dc4ae710c9.1484082593.git.tim.c.chen@linux.intel.com open here
Signed-off-by Tim Chen <[email protected]>
Signed-off-by "Huang, Ying" <[email protected]>
Cc Aaron Lu <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Hillf Danton <[email protected]>
Cc Huang Ying <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Jonathan Corbet <[email protected]> escreveu:
Cc Kirill A. Shutemov <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Shaohua Li <[email protected]>
Cc Vladimir Davydov <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/swap.h | 6 +++++ mm/swap_state.c | 4 +++ mm/swapfile.c | 47 +++++++++++++++++++++++++++++++++++------ 3 files changed, 51 insertions(+), 6 deletions(-)
include/linux/swap.h renamed from include/linux/swap.h~mm-swap-skip-read-ahead-for-unreferenced-swap-slots +6 -0
@@ -398,6 +398,7 @@ extern unsigned int count_swap_pages(intextern sector_t map_swap_page (struct page *,struct block_device **);extern sector_t swapdev_block (int ,pgoff_t );extern int page_swapcount (struct page *); +extern int __swp_swapcount (swp_entry_t entry);extern int swp_swapcount (swp_entry_t entry);extern struct swap_info_struct *page_swap_info (struct page *);extern bool reuse_swap_page (struct page *,int *);
@@ -491,6 +492,11 @@ static inline int page_swapcount(struct {return 0 ; } + +static inline int __swp_swapcount (swp_entry_t entry) +{ +return 0 ; +}static inline int swp_swapcount (swp_entry_t entry) {
mm/swap_state.c renamed from mm/swap_state.c~mm-swap-skip-read-ahead-for-unreferenced-swap-slots +4 -0
@@ -323,6 +323,10 @@ struct page *__read_swap_cache_async(swpif (found_page)break ; +/* Just skip read ahead for unused swap slot */ +if (!__swp_swapcount (entry)) +return NULL ; +/* * Get a new page to read into from swap. */
mm/swapfile.c renamed from mm/swapfile.c~mm-swap-skip-read-ahead-for-unreferenced-swap-slots +41 -6
73 lines not on this page · raw message
_