Skip to content

Commit 9dcdc0c

Browse files
x-y-zakpm00
authored andcommitted
mm/huge_memory: fix folio split stats counting
The "return <error code>" statements for error checks at the beginning of __folio_split() skip necessary count_vm_event() and count_mthp_stat() at the end of the function. Fix these by replacing them with "ret = <error code>; goto out;". Link: https://lkml.kernel.org/r/20251126210618.1971206-5-ziy@nvidia.com Signed-off-by: Zi Yan <ziy@nvidia.com> Reviewed-by: Wei Yang <richard.weiyang@gmail.com> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Acked-by: David Hildenbrand (Red Hat) <david@kernel.org> Cc: Balbir Singh <balbirs@nvidia.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Barry Song <baohua@kernel.org> Cc: Dev Jain <dev.jain@arm.com> Cc: Lance Yang <lance.yang@linux.dev> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Miaohe Lin <linmiaohe@huawei.com> Cc: Naoya Horiguchi <nao.horiguchi@gmail.com> Cc: Nico Pache <npache@redhat.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 2f78910 commit 9dcdc0c

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

mm/huge_memory.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,16 +3942,20 @@ static int __folio_split(struct folio *folio, unsigned int new_order,
39423942
VM_WARN_ON_ONCE_FOLIO(!folio_test_locked(folio), folio);
39433943
VM_WARN_ON_ONCE_FOLIO(!folio_test_large(folio), folio);
39443944

3945-
if (folio != page_folio(split_at) || folio != page_folio(lock_at))
3946-
return -EINVAL;
3945+
if (folio != page_folio(split_at) || folio != page_folio(lock_at)) {
3946+
ret = -EINVAL;
3947+
goto out;
3948+
}
39473949

3948-
if (new_order >= old_order)
3949-
return -EINVAL;
3950+
if (new_order >= old_order) {
3951+
ret = -EINVAL;
3952+
goto out;
3953+
}
39503954

39513955
ret = folio_check_splittable(folio, new_order, split_type);
39523956
if (ret) {
39533957
VM_WARN_ONCE(ret == -EINVAL, "Tried to split an unsplittable folio");
3954-
return ret;
3958+
goto out;
39553959
}
39563960

39573961
if (is_anon) {

0 commit comments

Comments
 (0)