diff options
| author | Andrew Morton <akpm@linux-foundation.org> | 2025-11-24 15:07:34 -0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2025-11-24 15:07:34 -0800 |
| commit | 87fcafc4e2b47da41300a0db558afc74d2e418b7 (patch) | |
| tree | e4e8918cad2944759fc48ab3c900d560c93c8e28 /mm/huge_memory.c | |
| parent | c7ba92bcfea34f6b4afc744c3b65c8f7420fefe0 (diff) | |
| parent | 7c9580f44f90f7a4c11fc7831efe323ebe446091 (diff) | |
Merge branch 'mm-hotfixes-stable' into mm-stable in order to merge
"mm/huge_memory: only get folio_order() once during __folio_split()" into
mm-stable.
Diffstat (limited to 'mm/huge_memory.c')
| -rw-r--r-- | mm/huge_memory.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index d716c6965e27..3ae16b4a82de 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3560,6 +3560,16 @@ static int __folio_split(struct folio *folio, unsigned int new_order, if (folio != page_folio(split_at) || folio != page_folio(lock_at)) return -EINVAL; + /* + * Folios that just got truncated cannot get split. Signal to the + * caller that there was a race. + * + * TODO: this will also currently refuse shmem folios that are in the + * swapcache. + */ + if (!is_anon && !folio->mapping) + return -EBUSY; + if (new_order >= folio_order(folio)) return -EINVAL; @@ -3600,18 +3610,6 @@ static int __folio_split(struct folio *folio, unsigned int new_order, gfp_t gfp; mapping = folio->mapping; - - /* Truncated ? */ - /* - * TODO: add support for large shmem folio in swap cache. - * When shmem is in swap cache, mapping is NULL and - * folio_test_swapcache() is true. - */ - if (!mapping) { - ret = -EBUSY; - goto out; - } - min_order = mapping_min_folio_order(folio->mapping); if (new_order < min_order) { ret = -EINVAL; |
