From: Matthew Wilcox <willy@infradead.org>
To: Peter Xu <peterx@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Mike Kravetz <mike.kravetz@oracle.com>,
David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Yu Zhao <yuzhao@google.com>, Ryan Roberts <ryan.roberts@arm.com>,
Yang Shi <shy828301@gmail.com>, Hugh Dickins <hughd@google.com>,
"Kirill A . Shutemov" <kirill@shutemov.name>
Subject: Re: [PATCH RFC v2 0/3] mm: Properly document tail pages for a folio
Date: Tue, 15 Aug 2023 22:03:00 +0100 [thread overview]
Message-ID: <ZNvoBAhrRvJI3COY@casper.infradead.org> (raw)
In-Reply-To: <ZNvidA8/FkfHk/YU@x1n>
On Tue, Aug 15, 2023 at 04:39:16PM -0400, Peter Xu wrote:
> On Tue, Aug 15, 2023 at 09:16:47PM +0100, Matthew Wilcox wrote:
> > No, sometimes there are things which shouldn't be documented because they
> > don't matter, and when changing code sometimes we forget to change the
> > documentation, and then people read the documentation which is different
> > from the code, and they get confused.
> >
> > It matters that the various 'private' members line up. It matters
> > that folio->index matches page->index. It does not matter what
> > offset _entire_mapcount is at. That can be moved around freely and no
> > documentation needs to be changed.
> >
> > I don't want you to use FOLIO_MATCH to make any unnecessary assertions.
> > The only assertion missing is for _private_1 and _private_2a, and that's
> > why I wrote a patch to add them.
>
> I didn't mean to add assertions for _entire_mapcount (I don't even know
> how..), but _mapcount and _refcount to clamp the fields, then all fields
> can be clear, just like head/flags clamping the start of fields.
Ah! mapcount does make sense, yes. We could just put a
/* no more space here */
comment in, but an assert works too.
> One thing I can understand that you'd like to avoid these "offset" things
> is perhaps because you keep that in mind to, one day, have mmdesc replacing
> folio so folio doesn't need to match struct page at all some day,
> ideally. The order of fields, size of fields, etc. none of them should
> matter, when it comes, and we should go toward that. However my argument
> would be that, before that day comes IMHO we need some good documentation
> for us to know how the fields look like now, why they worked, and how to
> reuse new fields.. when that comes, we can just safely remove these
> documentations.
>
> It's just that these 'offset's still matter and matters a lot now, imho,
> but it's very confusing when read without some help.
No, that's not why I'm opposed to them. I'm opposed to over-documenting
things, as I just outlined. Documentation is necessary and good for all
kinds of reasons, but it should be meaningful and not prone to rot. If
there's a tool that can tell you something, there's no point in
documenting it; that's why I pointed you towards pahole. I also
like "documentation" which is checked by the compiler, hence the
existence of the FOLIO_MATCH macro which documents that the two
structures line up, and the compiler checks that they do. FOLIO_MATCH
even caught a bug!
> Let me try one more time to see how you think about it on an rfcv3. If
> that still doesn't get any form of ack from you, I'll put this aside.
At least we've got to something that I like the idea of ;-)
next prev parent reply other threads:[~2023-08-15 21:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 18:44 Peter Xu
2023-08-14 18:44 ` [PATCH RFC v2 1/3] mm: Add TAIL_MAPPING_REUSED_MAX Peter Xu
2023-08-14 18:52 ` Peter Xu
2023-08-14 19:08 ` Matthew Wilcox
2023-08-14 19:51 ` Peter Xu
2023-08-14 18:44 ` [PATCH RFC v2 2/3] mm: Reorg and declare free spaces in struct folio tails Peter Xu
2023-08-14 18:44 ` [PATCH RFC v2 3/3] mm: Proper document tail pages fields for folio Peter Xu
2023-08-14 23:01 ` Randy Dunlap
2023-08-14 19:58 ` [PATCH RFC v2 0/3] mm: Properly document tail pages for a folio Matthew Wilcox
2023-08-14 20:21 ` Peter Xu
2023-08-15 3:45 ` Matthew Wilcox
2023-08-15 19:37 ` Peter Xu
2023-08-15 20:16 ` Matthew Wilcox
2023-08-15 20:39 ` Peter Xu
2023-08-15 21:03 ` Matthew Wilcox [this message]
2023-08-14 23:01 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZNvoBAhrRvJI3COY@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=peterx@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=yuzhao@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox