From: "Huang, Ying" <ying.huang@intel.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Xu <peterx@redhat.com>, Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@surriel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Michal Hocko <mhocko@kernel.org>,
Dave Hansen <dave.hansen@intel.com>,
Tim Chen <tim.c.chen@intel.com>
Subject: Re: [PATCH] mm: move idle swap cache pages to the tail of LRU after COW
Date: Thu, 20 May 2021 09:59:15 +0800 [thread overview]
Message-ID: <87im3e88ss.fsf@yhuang6-desk1.ccr.corp.intel.com> (raw)
In-Reply-To: <YKW/ix3Yg5HRuBaC@cmpxchg.org> (Johannes Weiner's message of "Wed, 19 May 2021 21:46:51 -0400")
Johannes Weiner <hannes@cmpxchg.org> writes:
> On Thu, May 20, 2021 at 09:22:45AM +0800, Huang, Ying wrote:
>> Johannes Weiner <hannes@cmpxchg.org> writes:
>>
>> > On Wed, May 19, 2021 at 09:33:13AM +0800, Huang Ying wrote:
>> >> diff --git a/mm/memory.c b/mm/memory.c
>> >> index b83f734c4e1d..2b6847f4c03e 100644
>> >> --- a/mm/memory.c
>> >> +++ b/mm/memory.c
>> >> @@ -3012,6 +3012,11 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf)
>> >> munlock_vma_page(old_page);
>> >> unlock_page(old_page);
>> >> }
>> >> + if (page_copied && PageSwapCache(old_page) &&
>> >> + !page_mapped(old_page) && trylock_page(old_page)) {
>> >> + try_to_free_idle_swapcache(old_page);
>> >> + unlock_page(old_page);
>> >
>> > If there are no more swap or pte references, can we just attempt to
>> > free the page right away, like we do during regular unmap?
>> >
>> > if (page_copied)
>> > free_swap_cache(old_page);
>> > put_page(old_page);
>>
>> A previous version of the patch does roughly this.
>>
>> https://lore.kernel.org/lkml/20210113024241.179113-1-ying.huang@intel.com/
>>
>> But Linus has concerns with the overhead introduced in the hot COW path.
>
> Sorry, I had missed that thread.
>
> It sounds like there were the same concerns about the LRU shuffling
> overhead in the COW page. Now we have numbers for that, but not the
> free_swap_cache version. Would you be able to run the numbers for that
> as well? It would be interesting to see how much the additional code
> complexity buys us.
The number for which workload? The workload that is used to evaluate
this patch?
>> Another possibility is to move the idle swap cache page to the tail of
>> the file LRU list. But the question is how to identify the page.
>
> The LRU type is identified by PG_swapbacked, and we do clear that for
> anon pages to implement MADV_FREE. It may work here too. But I'm
> honestly a bit skeptical about the ROI on this...
The definition of PageSwapCache() is
static __always_inline int PageSwapCache(struct page *page)
{
#ifdef CONFIG_THP_SWAP
page = compound_head(page);
#endif
return PageSwapBacked(page) && test_bit(PG_swapcache, &page->flags);
}
So we cannot clear PG_swapbacked directly.
Best Regards,
Huang, Ying
next prev parent reply other threads:[~2021-05-20 1:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 1:33 Huang Ying
2021-05-19 2:12 ` Rik van Riel
2021-05-19 4:56 ` Huang, Ying
2021-05-19 3:17 ` Linus Torvalds
2021-05-19 3:25 ` Linus Torvalds
2021-05-19 4:49 ` Huang, Ying
2021-05-19 14:49 ` Johannes Weiner
2021-05-20 1:22 ` Huang, Ying
2021-05-20 1:46 ` Johannes Weiner
2021-05-20 1:59 ` Huang, Ying [this message]
2021-05-20 17:49 ` Johannes Weiner
2021-05-21 2:05 ` Huang, Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87im3e88ss.fsf@yhuang6-desk1.ccr.corp.intel.com \
--to=ying.huang@intel.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=peterx@redhat.com \
--cc=riel@surriel.com \
--cc=tim.c.chen@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox