From: Usama Arif <usama.arif@linux.dev>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Usama Arif <usama.arif@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Jane Chu <jane.chu@oracle.com>,
linux-mm@kvack.org, 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>
Subject: Re: [PATCH v2 05/10] memory-failure: Remove raw_hwp_list_head()
Date: Fri, 10 Jul 2026 07:55:21 -0700 [thread overview]
Message-ID: <20260710145522.1718437-1-usama.arif@linux.dev> (raw)
In-Reply-To: <20260709184740.1286561-6-willy@infradead.org>
On Thu, 9 Jul 2026 19:47:33 +0100 "Matthew Wilcox (Oracle)" <willy@infradead.org> wrote:
> There's no need to hide the llist_head; we can just declare it
> directly in struct folio and do away with raw_hwp_list_head().
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> include/linux/mm_types.h | 4 ++--
> mm/memory-failure.c | 19 +++++--------------
> 2 files changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index b18c2b2e7d2c..d46f81f94848 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -387,7 +387,7 @@ typedef unsigned short mm_id_t;
> * @_hugetlb_subpool: Do not use directly, use accessor in hugetlb.h.
> * @_hugetlb_cgroup: Do not use directly, use accessor in hugetlb_cgroup.h.
> * @_hugetlb_cgroup_rsvd: Do not use directly, use accessor in hugetlb_cgroup.h.
> - * @_hugetlb_hwpoison: Do not use directly, call raw_hwp_list_head().
> + * @_hugetlb_hwpoison: Raw error pages, see struct raw_hwp_page.
s/_hugetlb_hwpoison/hugetlb_hwpoison/ in the doc above, apart
from that, LGTM.
Also good to add No functional change intended in the commit message.
Acked-by: Usama Arif <usama.arif@linux.dev>
> * @_deferred_list: Folios to be split under memory pressure.
> * @_unused_slab_obj_exts: Placeholder to match obj_exts in struct slab.
> *
> @@ -499,7 +499,7 @@ struct folio {
> void *_hugetlb_subpool;
> void *_hugetlb_cgroup;
> void *_hugetlb_cgroup_rsvd;
> - void *_hugetlb_hwpoison;
> + struct llist_head hugetlb_hwpoison;
> /* private: the union with struct page is transitional */
> };
> struct page __page_3;
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 51508a55c405..53063e2a1f97 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1810,21 +1810,15 @@ EXPORT_SYMBOL_GPL(mf_dax_kill_procs);
>
> /*
> * Struct raw_hwp_page represents information about "raw error page",
> - * constructing singly linked list from ->_hugetlb_hwpoison field of folio.
> + * constructing singly linked list from folio->hugetlb_hwpoison field.
> */
> struct raw_hwp_page {
> struct llist_node node;
> struct page *page;
> };
>
> -static inline struct llist_head *raw_hwp_list_head(struct folio *folio)
> -{
> - return (struct llist_head *)&folio->_hugetlb_hwpoison;
> -}
> -
> bool is_raw_hwpoison_page_in_hugepage(struct page *page)
> {
> - struct llist_head *raw_hwp_head;
> struct raw_hwp_page *p;
> struct folio *folio = page_folio(page);
> bool ret = false;
> @@ -1844,8 +1838,7 @@ bool is_raw_hwpoison_page_in_hugepage(struct page *page)
>
> mutex_lock(&mf_mutex);
>
> - raw_hwp_head = raw_hwp_list_head(folio);
> - llist_for_each_entry(p, raw_hwp_head->first, node) {
> + llist_for_each_entry(p, folio->hugetlb_hwpoison.first, node) {
> if (page == p->page) {
> ret = true;
> break;
> @@ -1863,7 +1856,7 @@ static unsigned long __folio_free_raw_hwp(struct folio *folio, bool move_flag)
> struct raw_hwp_page *p, *next;
> unsigned long count = 0;
>
> - head = llist_del_all(raw_hwp_list_head(folio));
> + head = llist_del_all(&folio->hugetlb_hwpoison);
> llist_for_each_entry_safe(p, next, head, node) {
> if (move_flag)
> SetPageHWPoison(p->page);
> @@ -1887,7 +1880,6 @@ static unsigned long __folio_free_raw_hwp(struct folio *folio, bool move_flag)
> */
> static int hugetlb_update_hwpoison(struct folio *folio, struct page *page)
> {
> - struct llist_head *head;
> struct raw_hwp_page *raw_hwp;
> struct raw_hwp_page *p;
> int ret = folio_test_set_hwpoison(folio) ? MF_HUGETLB_FOLIO_PRE_POISONED : 0;
> @@ -1899,8 +1891,7 @@ static int hugetlb_update_hwpoison(struct folio *folio, struct page *page)
> */
> if (folio_test_hugetlb_raw_hwp_unreliable(folio))
> return MF_HUGETLB_FOLIO_PRE_POISONED;
> - head = raw_hwp_list_head(folio);
> - llist_for_each_entry(p, head->first, node) {
> + llist_for_each_entry(p, folio->hugetlb_hwpoison.first, node) {
> if (p->page == page)
> return MF_HUGETLB_PAGE_PRE_POISONED;
> }
> @@ -1908,7 +1899,7 @@ static int hugetlb_update_hwpoison(struct folio *folio, struct page *page)
> raw_hwp = kmalloc_obj(struct raw_hwp_page, GFP_ATOMIC);
> if (raw_hwp) {
> raw_hwp->page = page;
> - llist_add(&raw_hwp->node, head);
> + llist_add(&raw_hwp->node, &folio->hugetlb_hwpoison);
> } else {
> /*
> * Failed to save raw error info. We no longer trace all
> --
> 2.47.3
>
>
next prev parent reply other threads:[~2026-07-10 14:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 18:47 [PATCH v2 00/10] Use generic_file_read_iter() in hugetlbfs Matthew Wilcox (Oracle)
2026-07-09 18:47 ` [PATCH v2 01/10] mm: Rename folio_contain_hwpoison_page() to folio_has_hwpoison_page() Matthew Wilcox (Oracle)
2026-07-10 14:27 ` Usama Arif
2026-07-09 18:47 ` [PATCH v2 02/10] hugetlb: Mark some function arguments as const Matthew Wilcox (Oracle)
2026-07-10 14:28 ` Usama Arif
2026-07-09 18:47 ` [PATCH v2 03/10] filemap: Remove checks in mapping_set_folio_order_range() Matthew Wilcox (Oracle)
2026-07-10 14:42 ` Usama Arif
2026-07-09 18:47 ` [PATCH v2 04/10] hugetlb: Set mapping folio order Matthew Wilcox (Oracle)
2026-07-10 14:49 ` Usama Arif
2026-07-09 18:47 ` [PATCH v2 05/10] memory-failure: Remove raw_hwp_list_head() Matthew Wilcox (Oracle)
2026-07-10 14:55 ` Usama Arif [this message]
2026-07-09 18:47 ` [PATCH v2 06/10] memory-failure: Prevent UAF in raw_hwp_page list Matthew Wilcox (Oracle)
2026-07-10 15:02 ` Usama Arif
2026-07-10 17:16 ` Matthew Wilcox
2026-07-09 18:47 ` [PATCH v2 07/10] mm: Handle hugetlb correctly in is_page_hwpoison() Matthew Wilcox (Oracle)
2026-07-09 18:47 ` [PATCH v2 08/10] filemap: Add hwpoison handling to filemap_read() Matthew Wilcox (Oracle)
2026-07-09 18:47 ` [PATCH v2 09/10] filemap: Add support for authoritative mappings Matthew Wilcox (Oracle)
2026-07-09 18:47 ` [PATCH v2 10/10] hugetlb: replace hugetlbfs_read_iter() with generic_file_read_iter() Matthew Wilcox (Oracle)
2026-07-09 19:19 ` [PATCH v2 00/10] Use generic_file_read_iter() in hugetlbfs Matthew Wilcox
2026-07-10 14:25 ` Usama Arif
2026-07-10 23:04 ` [syzbot ci] " syzbot ci
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=20260710145522.1718437-1-usama.arif@linux.dev \
--to=usama.arif@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=christian@brauner.io \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=jane.chu@oracle.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox