* [merged mm-nonmm-stable] tools-mm-prevent-page_owner_sort-from-truncating-input.patch removed from -mm tree
@ 2026-08-13 22:42 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-08-13 22:42 UTC (permalink / raw)
To: mm-commits, ziy, zhen.ni, ye.liu, vishal.moola, akpm,
warren.xiong, akpm
The quilt patch titled
Subject: tools/mm: prevent page_owner_sort from truncating input
has been removed from the -mm tree. Its filename was
tools-mm-prevent-page_owner_sort-from-truncating-input.patch
This patch was dropped because it was merged into the mm-nonmm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Warren Xiong <warren.xiong@ugreen.com>
Subject: tools/mm: prevent page_owner_sort from truncating input
Date: Thu, 30 Jul 2026 09:58:09 +0800
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>
---
tools/mm/page_owner_sort.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- a/tools/mm/page_owner_sort.c~tools-mm-prevent-page_owner_sort-from-truncating-input
+++ a/tools/mm/page_owner_sort.c
@@ -788,8 +788,7 @@ int main(int argc, char **argv)
}
fin = fopen(argv[optind], "r");
- fout = fopen(argv[optind + 1], "w");
- if (!fin || !fout) {
+ if (!fin) {
usage();
perror("open: ");
exit(1);
@@ -826,6 +825,13 @@ int main(int argc, char **argv)
goto out_free;
}
+ fout = fopen(argv[optind + 1], "w");
+ if (!fout) {
+ usage();
+ perror("open: ");
+ exit(1);
+ }
+
printf("loaded %d\n", list_size);
printf("sorting ....\n");
_
Patches currently in -mm which might be from warren.xiong@ugreen.com are
selftests-mm-read-memory-information-without-popen.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-13 22:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 22:42 [merged mm-nonmm-stable] tools-mm-prevent-page_owner_sort-from-truncating-input.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.