[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230106174028.151384-1-sj@kernel.org>
Date: Fri, 6 Jan 2023 17:40:25 +0000
From: SeongJae Park <sj@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: SeongJae Park <sj@...nel.org>, willy@...radead.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: [PATCH 0/3] add folio_headpage() macro
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)'.
SeongJae Park (3):
include/linux/page-flags: add folio_headpage()
mm: use folio_headpage() instead of folio_page()
fs/ceph/addr: use folio_headpage() instead of folio_page()
fs/ceph/addr.c | 2 +-
include/linux/page-flags.h | 8 ++++++++
mm/shmem.c | 4 ++--
mm/slab.c | 6 +++---
mm/slab_common.c | 4 ++--
mm/slub.c | 4 ++--
6 files changed, 18 insertions(+), 10 deletions(-)
--
2.25.1
Powered by blists - more mailing lists