From: Zi Yan <ziy@nvidia.com>
To: David Hildenbrand <david@redhat.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Dan Carpenter <dan.carpenter@linaro.org>,
Antonio Quartulli <antonio@mandelbit.com>,
Hugh Dickins <hughd@google.com>,
Kirill Shutemov <k.shutemov@gmail.com>, Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Nico Pache <npache@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>, Balbir Singh <balbirs@nvidia.com>,
Matthew Brost <matthew.brost@intel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v5 4/6] mm/huge_memory: convert VM_BUG* to VM_WARN* in __folio_split.
Date: Fri, 18 Jul 2025 14:37:18 -0400 [thread overview]
Message-ID: <20250718183720.4054515-5-ziy@nvidia.com> (raw)
In-Reply-To: <20250718183720.4054515-1-ziy@nvidia.com>
These VM_BUG* can be handled gracefully without crashing kernel.
Signed-off-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
mm/huge_memory.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index d36f7bdaeb38..d98283164eda 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3601,8 +3601,8 @@ static int __folio_split(struct folio *folio, unsigned int new_order,
pgoff_t end;
bool is_hzp;
- VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
- VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
+ VM_WARN_ON_ONCE_FOLIO(!folio_test_locked(folio), folio);
+ VM_WARN_ON_ONCE_FOLIO(!folio_test_large(folio), folio);
if (folio != page_folio(split_at) || folio != page_folio(lock_at))
return -EINVAL;
@@ -3766,7 +3766,11 @@ static int __folio_split(struct folio *folio, unsigned int new_order,
}
if (folio_test_swapcache(folio)) {
- VM_BUG_ON(mapping);
+ if (mapping) {
+ VM_WARN_ON_ONCE_FOLIO(mapping, folio);
+ ret = -EINVAL;
+ goto fail;
+ }
swap_cache = swap_address_space(folio->swap);
xa_lock(&swap_cache->i_pages);
--
2.47.2
next prev parent reply other threads:[~2025-07-18 18:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 18:37 [PATCH v5 0/6] __folio_split() clean up Zi Yan
2025-07-18 18:37 ` [PATCH v5 1/6] mm/huge_memory: move unrelated code out of __split_unmapped_folio() Zi Yan
2025-07-18 18:37 ` [PATCH v5 2/6] mm/huge_memory: remove after_split label in __split_unmapped_folio() Zi Yan
2025-07-18 18:37 ` [PATCH v5 3/6] mm/huge_memory: deduplicate code in __folio_split() Zi Yan
2025-07-18 19:10 ` Lorenzo Stoakes
2025-07-18 18:37 ` Zi Yan [this message]
2025-07-22 15:34 ` [PATCH v5 4/6] mm/huge_memory: convert VM_BUG* to VM_WARN* in __folio_split David Hildenbrand
2025-07-18 18:37 ` [PATCH v5 5/6] mm/huge_memory: get frozen folio refcount with folio_expected_ref_count() Zi Yan
2025-07-18 18:37 ` [PATCH v5 6/6] mm/huge_memory: refactor after-split (page) cache code Zi Yan
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=20250718183720.4054515-5-ziy@nvidia.com \
--to=ziy@nvidia.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=antonio@mandelbit.com \
--cc=balbirs@nvidia.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dan.carpenter@linaro.org \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=hughd@google.com \
--cc=k.shutemov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=matthew.brost@intel.com \
--cc=npache@redhat.com \
--cc=ryan.roberts@arm.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
all inboxes | Powered by JetHome®