lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Za6mr0OW9DW0y9Gn@casper.infradead.org>
Date: Mon, 22 Jan 2024 17:32:31 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Ryan Roberts <ryan.roberts@....com>
Cc: David Hildenbrand <david@...hat.com>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
	Hugh Dickins <hughd@...gle.com>,
	Yin Fengwei <fengwei.yin@...el.com>,
	Mike Kravetz <mike.kravetz@...cle.com>,
	Muchun Song <muchun.song@...ux.dev>, Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH v2 28/40] mm/memory: page_remove_rmap() ->
 folio_remove_rmap_pte()

On Mon, Jan 22, 2024 at 05:26:00PM +0000, Ryan Roberts wrote:
> On 22/01/2024 17: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.
> > 
> > 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.
> 
> Is there anything stopping us from renaming set_page_dirty() to
> mark_page_dirty() (or page_mark_dirty())? For me the folio naming is consistent,
> but the page names suck; presumably PageSetDirty() and set_page_dirty()... yuk.

Well, laziness.  There's about 150 places where we mention
set_page_dirty() and all of them need to be converted to
folio_mark_dirty().  I don't particularly like converting code twice;
I get the impression it annoys people.

The important thing is what does it look like when someone writes
a new filesystem in 2030.  I fear that they may get confused and
call folio_set_dirty(), not realising that they should be calling
folio_mark_dirty().  It doesn't help that btrfs have decided to introduce
btrfs_folio_set_dirty().

I think MM people can afford to add a leading '_' to folio_set_dirty()
so that's my current favourite option for fixing this mess.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ