[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230106194507.152468-1-sj@kernel.org>
Date: Fri, 6 Jan 2023 19:45:07 +0000
From: SeongJae Park <sj@...nel.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: SeongJae Park <sj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Xiubo Li <xiubli@...hat.com>,
Ilya Dryomov <idryomov@...il.com>,
Jeff Layton <jlayton@...nel.org>, linux-mm@...ck.org,
ceph-devel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/3] add folio_headpage() macro
On Fri, 6 Jan 2023 19:21:40 +0000 Matthew Wilcox <willy@...radead.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
Powered by blists - more mailing lists