[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YfFbOypqMjkeNA3q@casper.infradead.org>
Date: Wed, 26 Jan 2022 14:31:23 +0000
From: Matthew Wilcox <willy@...radead.org>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
David Rientjes <rientjes@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>,
John Hubbard <jhubbard@...dia.com>,
Jason Gunthorpe <jgg@...dia.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Mike Rapoport <rppt@...ux.ibm.com>,
Yang Shi <shy828301@...il.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>,
Michal Hocko <mhocko@...nel.org>,
Nadav Amit <namit@...are.com>, Rik van Riel <riel@...riel.com>,
Roman Gushchin <guro@...com>,
Andrea Arcangeli <aarcange@...hat.com>,
Peter Xu <peterx@...hat.com>,
Donald Dutile <ddutile@...hat.com>,
Christoph Hellwig <hch@....de>,
Oleg Nesterov <oleg@...hat.com>, Jan Kara <jack@...e.cz>,
Liang Zhang <zhangliang5@...wei.com>, linux-mm@...ck.org
Subject: Re: [PATCH RFC v2 2/9] mm: optimize do_wp_page() for fresh pages in
local LRU pagevecs
On Wed, Jan 26, 2022 at 10:55:50AM +0100, David Hildenbrand wrote:
> diff --git a/mm/memory.c b/mm/memory.c
> index bcd3b7c50891..61d67ceef734 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3298,7 +3298,17 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
> *
> * PageKsm() doesn't necessarily raise the page refcount.
> */
> - if (PageKsm(page) || page_count(page) > 1 + PageSwapCache(page))
> + if (PageKsm(page))
> + goto copy;
> + if (page_count(page) > 1 + PageSwapCache(page) + !PageLRU(page))
> + goto copy;
> + if (!PageLRU(page))
> + /*
> + * Note: We cannot easily detect+handle references from
> + * remote LRU pagevecs or references to PageLRU() pages.
> + */
> + lru_add_drain();
> + if (page_count(page) > 1 + PageSwapCache(page))
> goto copy;
I worry we're starting to get too accurate here. How about:
if (PageKsm(page) || page_count(page) > 3)
goto copy;
if (!PageLRU(page))
lru_add_drain();
if (!trylock_page(page))
goto copy;
...
> if (!trylock_page(page))
> goto copy;
> --
> 2.34.1
>
Powered by blists - more mailing lists