[merged mm-nonmm-stable] tools-mm-prevent-page_owner_sort-from-truncating-input.patch removed from -mm tree

Andrew Morton <[email protected]>
Newsgroups org.kernel.vger.mm-commits
Message-ID <[email protected]>
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 <[email protected]>
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/[email protected]
Signed-off-by: Warren Xiong <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Vishal Moola <[email protected]>
Cc: Ye Liu <[email protected]>
Cc: Zhen Ni <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 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 [email protected] are

selftests-mm-read-memory-information-without-popen.patch
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.