Re: [PATCH v2 28/40] mm/memory: page_remove_rmap() -> folio_remove_rmap_pte()

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

 



On 22.01.24 18:20, Matthew Wilcox wrote:
On Mon, Jan 22, 2024 at 06:01:58PM +0100, David Hildenbrand wrote:
And folio_mark_dirty() is doing more than just setting teh PG_dirty bit. In my
equivalent change, as part of the contpte series, I've swapped set_page_dirty()
for folio_mark_dirty().

Good catch, that should be folio_mark_dirty(). Let me send a fixup.

(the difference in naming for both functions really is bad)

It really is, and I don't know what to do about it.

We need a function that literally just sets the flag.  For every other
flag, that's folio_set_FLAG.  We can't use __folio_set_flag because that
means "set the flag non-atomically".

We need a function that does all of the work involved with tracking
dirty folios.  I chose folio_mark_dirty() to align with
folio_mark_uptodate() (ie mark is not just 'set" but also "do some extra
work").

But because we're converting from set_page_dirty(), the OBVIOUS rename
is to folio_set_dirty(), which is WRONG.

And I made the same mistake at least also in "mm/huge_memory: page_remove_rmap() -> folio_remove_rmap_pmd()".

I better double check all these so-simple-looking conversions that just went upstream.

Interestingly, __split_huge_pmd_locked() used SetPageReferenced() instead of


So we're in the part of the design space where the consistent naming and
the-obvious-thing-to-do-is-wrong are in collision, and I do not have a
good answer.

Maybe we can call the first function _folio_set_dirty(), and we don't
have a folio_set_dirty() at all?  We don't have a folio_set_uptodate(),
so there's some precedent there.

Good question. This mark vs. set is confusing. We want some way to highlight that folio_set_dirty() is the one that we usually do not want to use.

--
Cheers,

David / dhildenb





[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