Thread (2 messages) 2 messages, 2 authors, 2018-02-26

Re: [PATCH RESEND 1/2] mm: swap: clean up swap readahead

From: Minchan Kim <minchan@kernel.org>
Date: 2018-02-26 04:56:25
Also in: lkml
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

On Fri, Feb 23, 2018 at 04:02:27PM +0800, Huang, Ying wrote:
[off-list ref] writes:
[snip]
quoted
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 39ae7cfad90f..c56cce64b2c3 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -332,32 +332,38 @@ struct page *lookup_swap_cache(swp_entry_t entry, struct vm_area_struct *vma,
 			       unsigned long addr)
 {
 	struct page *page;
-	unsigned long ra_info;
-	int win, hits, readahead;
 
 	page = find_get_page(swap_address_space(entry), swp_offset(entry));
 
 	INC_CACHE_INFO(find_total);
 	if (page) {
+		bool vma_ra = swap_use_vma_readahead();
+		bool readahead = TestClearPageReadahead(page);
+
TestClearPageReadahead() cannot be called for compound page.  As in

PAGEFLAG(Readahead, reclaim, PF_NO_COMPOUND)
	TESTCLEARFLAG(Readahead, reclaim, PF_NO_COMPOUND)
quoted
 		INC_CACHE_INFO(find_success);
 		if (unlikely(PageTransCompound(page)))
 			return page;
-		readahead = TestClearPageReadahead(page);
So we can only call it here after checking whether page is compound.
Hi Huang,

Thanks for cathing this.
However, I don't see the reason we should rule out THP page for
readahead marker. Could't we relax the rule?

I hope we can do so that we could remove PageTransCompound check
for readahead marker, which makes code ugly.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help