linux/tools/mm
Warren Xiong 825cef942c tools/mm: prevent page_owner_sort from truncating input
page_owner_sort opens the output file with "w" before reading the input. 
If both paths refer to the same file, this truncates the input and the
tool silently processes zero records before returning success.

Delay opening the output file until all input records have been loaded
into memory.  This allows the tool to sort a file in place without
truncating data before it has been consumed.

Link: https://lore.kernel.org/20260730015809.3819606-1-warren.xiong@ugreen.com
Signed-off-by: Warren Xiong <warren.xiong@ugreen.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Vishal Moola <vishal.moola@gmail.com>
Cc: Ye Liu <ye.liu@linux.dev>
Cc: Zhen Ni <zhen.ni@easystack.cn>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
History 2026-08-13 15:42:06 -07:00
..
.gitignore tools/vm: rename tools/vm to tools/mm 2023-01-18 17:12:55 -08:00
Makefile tools/mm: rm thp_swap_allocator_test when make clean 2024-09-09 16:47:41 -07:00
page-types.c tools/mm/page-types: fix kpageflags option argument in getopt_long 2026-06-02 15:22:18 -07:00
page_owner_sort.c tools/mm: prevent page_owner_sort from truncating input 2026-08-13 15:42:06 -07:00
show_page_info.py tools/mm: add script to display page state for a given PID and VADDR 2025-07-09 22:41:53 -07:00
slabinfo-gnuplot.sh tools/vm: rename tools/vm to tools/mm 2023-01-18 17:12:55 -08:00
slabinfo.c tools/mm/slabinfo: fix total_objects attribute name 2026-06-18 11:19:43 +02:00
thp_swap_allocator_test.c tools/mm/thp_swap_allocator_test: fix small folio alignment 2026-01-20 19:24:42 -08:00
thpmaps tools/mm: add thpmaps script to dump THP usage info 2024-02-22 10:24:38 -08:00