Re: [PATCH mmotm] mm: filemap_unaccount_folio() large skip mapcount fixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux