From: SeongJae Park <sj@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
Jeff Layton <jlayton@kernel.org>,
linux-mm@kvack.org, ceph-devel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] add folio_headpage() macro
Date: Fri, 6 Jan 2023 19:45:07 +0000 [thread overview]
Message-ID: <20230106194507.152468-1-sj@kernel.org> (raw)
In-Reply-To: <Y7h0xNGlj0qzFlua@casper.infradead.org>
On Fri, 6 Jan 2023 19:21:40 +0000 Matthew Wilcox <willy@infradead.org> wrote:
> On Fri, Jan 06, 2023 at 05:40:25PM +0000, SeongJae Park wrote:
> > The standard idiom for getting head page of a given folio is
> > '&folio->page'. It is efficient and safe even if the folio is NULL,
> > because the offset of page field in folio is zero. However, it makes
> > the code not that easy to understand at the first glance, especially the
> > NULL safety. Also, sometimes people forget the idiom and use
> > 'folio_page(folio, 0)' instead. To make it easier to read and remember,
> > add a new macro function called 'folio_headpage()' with the NULL case
> > explanation. Then, replace the 'folio_page(folio, 0)' calls with
> > 'folio_headpage(folio)'.
>
> No. Everywhere that uses &folio->page is a place that needs to be fixed.
> It shouldn't have a nice convenience macro. It should make you mildly
> uncomfortable.
It's true that it's just a mild uncomfortableness. I will respect your opinion
here. Thanks for the input.
Thanks,
SJ
next prev parent reply other threads:[~2023-01-06 19:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 17:40 [PATCH 0/3] add folio_headpage() macro SeongJae Park
2023-01-06 17:40 ` [PATCH 1/3] include/linux/page-flags: add folio_headpage() SeongJae Park
2023-01-06 17:40 ` [PATCH 2/3] mm: use folio_headpage() instead of folio_page() SeongJae Park
2023-01-06 19:37 ` Matthew Wilcox
2023-01-06 17:40 ` [PATCH 3/3] fs/ceph/addr: " SeongJae Park
2023-01-06 19:39 ` Matthew Wilcox
2023-01-06 19:21 ` [PATCH 0/3] add folio_headpage() macro Matthew Wilcox
2023-01-06 19:45 ` SeongJae Park [this message]
2023-01-09 11:35 ` Xiubo Li
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=20230106194507.152468-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
--cc=xiubli@redhat.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;
as well as URLs for NNTP newsgroup(s).