Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1678384 > unrolled thread
| Started by | "Huang, Ying" <ying.huang@intel.com> |
|---|---|
| First post | 2017-06-30 03:50 +0200 |
| Last post | 2017-06-30 03:50 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH -mm -v2 3/6] mm, swap: Fix swap readahead marking "Huang, Ying" <ying.huang@intel.com> - 2017-06-30 03:50 +0200
| From | "Huang, Ying" <ying.huang@intel.com> |
|---|---|
| Date | 2017-06-30 03:50 +0200 |
| Subject | [PATCH -mm -v2 3/6] mm, swap: Fix swap readahead marking |
| Message-ID | <tXTeh-7bI-7@gated-at.bofh.it> |
From: Huang Ying <ying.huang@intel.com>
In the original implementation, it is possible that the existing pages
in the swap cache (not newly readahead) could be marked as the
readahead pages. This will cause the statistics of swap readahead be
wrong and influence the swap readahead algorithm too.
This is fixed via marking a page as the readahead page only if it is
newly allocated and read from the disk.
When testing with linpack, after the fixing the swap readahead hit
rate increased from ~66% to ~86%.
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Shaohua Li <shli@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Tim Chen <tim.c.chen@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
---
mm/swap_state.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 6739343a3695..b40fb227021d 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -500,7 +500,7 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask,
unsigned long start_offset, end_offset;
unsigned long mask;
struct blk_plug plug;
- bool do_poll = true;
+ bool do_poll = true, page_allocated;
mask = swapin_nr_pages(offset) - 1;
if (!mask)
@@ -516,14 +516,18 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask,
blk_start_plug(&plug);
for (offset = start_offset; offset <= end_offset ; offset++) {
/* Ok, do the async read-ahead now */
- page = read_swap_cache_async(swp_entry(swp_type(entry), offset),
- gfp_mask, vma, addr, false);
+ page = __read_swap_cache_async(
+ swp_entry(swp_type(entry), offset),
+ gfp_mask, vma, addr, &page_allocated);
if (!page)
continue;
- if (offset != entry_offset &&
- likely(!PageTransCompound(page))) {
- SetPageReadahead(page);
- atomic_long_inc(&swapin_readahead_total);
+ if (page_allocated) {
+ swap_readpage(page, false);
+ if (offset != entry_offset &&
+ likely(!PageTransCompound(page))) {
+ SetPageReadahead(page);
+ atomic_long_inc(&swapin_readahead_total);
+ }
}
put_page(page);
}
--
2.11.0
Back to top | Article view | linux.kernel
csiph-web