On 19.11.25 14:41, Wei Yang wrote:
On Wed, Nov 19, 2025 at 08:08:01AM -0500, Zi Yan wrote:
On 19 Nov 2025, at 7:54, David Hildenbrand (Red Hat) wrote:
So I think we should try to keep truncation return -EBUSY. For the shmem case, I think it's ok to return -EINVAL. I guess we can identify such folios by checking for folio_test_swapcache().
Hmm... Don't get how to do this nicely.
Looks we can't do it in folio_split_supported().
Or change folio_split_supported() return error code directly?
On upstream, I would do something like the following (untested):
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 2f2a521e5d683..33fc3590867e2 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3524,6 +3524,9 @@ bool non_uniform_split_supported(struct folio *folio, unsigned int new_order, "Cannot split to order-1 folio"); if (new_order == 1) return false;
} else if (folio_test_swapcache(folio)) {/* TODO: support shmem folios that are in the swapcache. */return false;Hmm... we are filtering out all swapcache instead of just shmem swapcache?
Is it possible for (folio->mapping && folio_test_swapcache(folio)) reach here? Looks the logic is little different, but maybe I missed something.
OK, my brain is out of state. Hope I don't make stupid mistake.
It's tricky. folio_test_swapcache() only applies to anon and shmem.
But looking at it, we have
PG_swapcache = PG_owner_priv_1,
PG_owner_priv_1 is also used for * XEN stuff * vmemmap_self_hosted
Which is not important for us IIRC.
But we have
/* Some filesystems */ PG_checked = PG_owner_priv_1
So maybe we could indeed have false positives here.
So I guess we cannot rely on folio_test_swapcache() ... here. What a mess.