]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/mm: free dynamically allocated PMD-sized buffers in split_huge_page_test
authorSayali Patil <sayalip@linux.ibm.com>
Thu, 21 May 2026 06:47:47 +0000 (12:17 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 21 Jun 2026 18:37:33 +0000 (11:37 -0700)
commite5d3e1422e92d54e28e81fad8bfc7c1ecb41a353
tree95c568eb8fcf6fe7056b680106f13366f521a4b3
parenta2dde8a065d5c8d63b53b1c8f035017e4aeac0c2
selftests/mm: free dynamically allocated PMD-sized buffers in split_huge_page_test

Dynamically allocated buffers of PMD size for file-backed THP operations
(file_buf1 and file_buf2) were not freed on the success path and some
failure paths.  Since the function is called repeatedly in a loop for each
split order, this can cause significant memory leaks.

On architectures with large PMD sizes, repeated leaks could exhaust system
memory and trigger the OOM killer during test execution.

Ensure all allocated buffers are freed to maintain stable repeated test
runs.

Link: https://lore.kernel.org/060c673b376bbeeed2b1fb1d48a825e846654191.1779296493.git.sayalip@linux.ibm.com
Fixes: 035a112e5fd5 ("selftests/mm: make file-backed THP split work by writing PMD size data")
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/split_huge_page_test.c