From: jane.chu@oracle.com
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org
Cc: Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
David Hildenbrand <david@kernel.org>,
Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org,
Christian Brauner <christian@brauner.io>,
Jiaqi Yan <jiaqiyan@google.com>,
Usama Arif <usama.arif@linux.dev>,
Gregory Price <gourry@gourry.net>
Subject: Re: [PATCH v8 04/15] hugetlb: Mark some function arguments as const
Date: Mon, 3 Aug 2026 23:41:52 -0700 [thread overview]
Message-ID: <92dfd4be-e25f-439e-a9cc-258e338f4d12@oracle.com> (raw)
In-Reply-To: <20260731200802.574821-5-willy@infradead.org>
On 7/31/2026 1:07 PM, Matthew Wilcox (Oracle) wrote:
> These functions do not modify their folio argument, so we can mark them
> as being const which will allow for some minor optimisations and let us
> mark other function arguments as being const in the future. Signed-off-
> by: Matthew Wilcox (Oracle)
>
>
> These functions do not modify their folio argument, so we can mark them
> as being const which will allow for some minor optimisations and let us
> mark other function arguments as being const in the future.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Acked-by: Usama Arif <usama.arif@linux.dev>
> Reviewed-by: Gregory Price <gourry@gourry.net>
> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> include/linux/hugetlb.h | 19 +++++++++----------
> mm/hugetlb.c | 2 +-
> 2 files changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> index 50eab2c23299..e200c93088bc 100644
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -176,7 +176,7 @@ bool hugetlbfs_pagecache_present(struct hstate *h,
> struct vm_area_struct *vma,
> unsigned long address);
>
> -struct address_space *hugetlb_folio_mapping_lock_write(struct folio *folio);
> +struct address_space *hugetlb_folio_mapping_lock_write(const struct folio *folio);
>
> extern int movable_gigantic_pages __read_mostly;
> extern int sysctl_hugetlb_shm_group __read_mostly;
> @@ -311,8 +311,7 @@ static inline unsigned long hugetlb_total_pages(void)
> return 0;
> }
>
> -static inline struct address_space *hugetlb_folio_mapping_lock_write(
> - struct folio *folio)
> +static inline struct address_space *hugetlb_folio_mapping_lock_write(const struct folio *folio)
> {
> return NULL;
> }
> @@ -614,8 +613,8 @@ enum hugetlb_page_flags {
> #ifdef CONFIG_HUGETLB_PAGE
> #define TESTHPAGEFLAG(uname, flname) \
> static __always_inline \
> -bool folio_test_hugetlb_##flname(struct folio *folio) \
> - { void *private = &folio->private; \
> +bool folio_test_hugetlb_##flname(const struct folio *folio) \
> + { const void *private = &folio->private; \
> return test_bit(HPG_##flname, private); \
> }
>
> @@ -635,7 +634,7 @@ void folio_clear_hugetlb_##flname(struct folio *folio) \
> #else
> #define TESTHPAGEFLAG(uname, flname) \
> static inline bool \
> -folio_test_hugetlb_##flname(struct folio *folio) \
> +folio_test_hugetlb_##flname(const struct folio *folio) \
> { return 0; }
>
> #define SETHPAGEFLAG(uname, flname) \
> @@ -746,7 +745,7 @@ static inline struct hugepage_subpool *subpool_inode(struct inode *inode)
> return HUGETLBFS_SB(inode->i_sb)->spool;
> }
>
> -static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio)
> +static inline struct hugepage_subpool *hugetlb_folio_subpool(const struct folio *folio)
> {
> return folio->_hugetlb_subpool;
> }
> @@ -876,7 +875,7 @@ static inline bool arch_has_huge_bootmem_alloc(void)
> }
> #endif
>
> -static inline struct hstate *folio_hstate(struct folio *folio)
> +static inline struct hstate *folio_hstate(const struct folio *folio)
> {
> VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio);
> return size_to_hstate(folio_size(folio));
> @@ -1107,7 +1106,7 @@ static inline unsigned long huge_page_mask_align(struct file *file)
> return 0;
> }
>
> -static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio)
> +static inline struct hugepage_subpool *hugetlb_folio_subpool(const struct folio *folio)
> {
> return NULL;
> }
> @@ -1176,7 +1175,7 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
> return NULL;
> }
>
> -static inline struct hstate *folio_hstate(struct folio *folio)
> +static inline struct hstate *folio_hstate(const struct folio *folio)
> {
> return NULL;
> }
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 571212b80835..cc8d98399913 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1775,7 +1775,7 @@ void init_new_hugetlb_folio(struct folio *folio)
> * stable. Due to locking order, we can only trylock_write. If we can
> * not get the lock, simply return NULL to caller.
> */
> -struct address_space *hugetlb_folio_mapping_lock_write(struct folio *folio)
> +struct address_space *hugetlb_folio_mapping_lock_write(const struct folio *folio)
> {
> struct address_space *mapping = folio_mapping(folio);
>
> --
> 2.47.3
>
Reviewed-by: Jane Chu <jane.chu@oracle.com>
thanks,
-jane
next prev parent reply other threads:[~2026-08-04 6:42 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 20:07 [PATCH v8 00/15] Use generic_file_read_iter() in hugetlbfs Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 01/15] memory-failure: Fix hardware poison check in unpoison_memory() again Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 02/15] memory-failure: Prevent hugetlb freeing during unpoisoning Matthew Wilcox (Oracle)
2026-08-04 6:40 ` jane.chu
2026-08-04 15:35 ` Matthew Wilcox
2026-08-04 21:22 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 03/15] mm: Rename folio_contain_hwpoison_page() to folio_has_hwpoison_page() Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 04/15] hugetlb: Mark some function arguments as const Matthew Wilcox (Oracle)
2026-08-04 6:41 ` jane.chu [this message]
2026-07-31 20:07 ` [PATCH v8 05/15] guest_memfd: Use folio_has_hwpoisoned_page() Matthew Wilcox (Oracle)
2026-08-04 6:42 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 06/15] kpageflags: Use is_page_hwpoison() to set KPF_HWPOISON Matthew Wilcox (Oracle)
2026-08-04 6:44 ` jane.chu
2026-08-04 15:46 ` Matthew Wilcox
2026-08-04 20:21 ` jane.chu
2026-08-04 16:13 ` Gregory Price
2026-07-31 20:07 ` [PATCH v8 07/15] hugetlb: Move poison to pages before clearing hugetlb page type Matthew Wilcox (Oracle)
2026-08-04 6:47 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 08/15] hugetlb: Use the has_hwpoisoned flag Matthew Wilcox (Oracle)
2026-08-04 6:51 ` jane.chu
2026-08-04 16:04 ` Matthew Wilcox
2026-08-04 16:28 ` Gregory Price
2026-08-04 16:42 ` Matthew Wilcox
2026-08-04 18:43 ` Gregory Price
2026-07-31 20:07 ` [PATCH v8 09/15] mm: Remove locking mf_mutex in is_raw_hwpoison_page_in_hugepage() Matthew Wilcox (Oracle)
2026-08-04 6:56 ` jane.chu
2026-08-04 16:36 ` Gregory Price
2026-08-04 16:58 ` Matthew Wilcox
2026-08-04 18:47 ` Gregory Price
2026-08-04 20:32 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 10/15] mm: Check individual hugetlb pages for poison Matthew Wilcox (Oracle)
2026-08-04 6:59 ` jane.chu
2026-08-04 19:15 ` Gregory Price
2026-08-04 21:21 ` Matthew Wilcox
2026-08-04 23:01 ` Gregory Price
2026-07-31 20:07 ` [PATCH v8 11/15] filemap: Add hwpoison handling to filemap_read() Matthew Wilcox (Oracle)
2026-07-31 20:07 ` [PATCH v8 12/15] filemap: Remove checks in mapping_set_folio_order_range() Matthew Wilcox (Oracle)
2026-08-04 7:01 ` jane.chu
2026-08-04 21:23 ` Gregory Price
2026-08-05 3:28 ` Matthew Wilcox
2026-07-31 20:07 ` [PATCH v8 13/15] hugetlb: Set mapping folio order Matthew Wilcox (Oracle)
2026-08-04 7:01 ` jane.chu
2026-07-31 20:07 ` [PATCH v8 14/15] filemap: Add support for authoritative mappings Matthew Wilcox (Oracle)
2026-08-04 7:02 ` jane.chu
2026-07-31 20:08 ` [PATCH v8 15/15] hugetlb: replace hugetlbfs_read_iter() with generic_file_read_iter() Matthew Wilcox (Oracle)
2026-08-04 21:26 ` Gregory Price
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=92dfd4be-e25f-439e-a9cc-258e338f4d12@oracle.com \
--to=jane.chu@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=christian@brauner.io \
--cc=david@kernel.org \
--cc=gourry@gourry.net \
--cc=jack@suse.cz \
--cc=jiaqiyan@google.com \
--cc=linmiaohe@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@suse.de \
--cc=usama.arif@linux.dev \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.