[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YiGW+J4EtjK7KgYn@casper.infradead.org>
Date: Fri, 4 Mar 2022 04:35:04 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Hugh Dickins <hughd@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH mmotm] mm: filemap_unaccount_folio() large skip mapcount
fixup
On Thu, Mar 03, 2022 at 08:21:19PM -0800, Hugh Dickins wrote:
> The page_mapcount_reset() when folio_mapped() while mapping_exiting()
> was devised long before there were huge or compound pages in the cache.
> It is still valid for small pages, but not at all clear what's right to
> check and reset on large pages. Just don't try when folio_test_large().
Thanks for bringing this up! I was really unsure about this chunk of code
when converting unaccount_page_cache_page() to filemap_unaccount_folio().
Part of me wants to just delete the whole thing. I'm unconvinced by
the argument; surely it's better to leak memory than perhaps reuse a
page which should not have been freed yet?
Also, the code doesn't take into account that folio_mapped() is freaking
expensive for THP (512 cache lines, blowing away 32kB of your L1 cache!),
and we may as well calculate folio_mapcount() while we're doing it.
Do you see this report often on machines that don't have
VM_BUG_ON_FOLIO() enabled?
Powered by blists - more mailing lists