Skip to contentSkip to conversation

tools-lib-list_sort-remove-redundant-code-for-cond_resched-handling.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Jun 25, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: tools/lib/list_sort: remove redundant code for cond_resched handling
has been removed from the -mm tree. Its filename was
tools-lib-list_sort-remove-redundant-code-for-cond_resched-handling.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: Kuan-Wei Chiu <[email protected]>
Subject: tools/lib/list_sort: remove redundant code for cond_resched handling
Date: Sun, 26 May 2024 07:02:06 +0800

Since cond_resched() is not called in userspace, remove the redundant code in userspace's list_sort() implementation. This change eliminates the unused 'count' variable and the associated logic for invoking cmp() periodically, which was intended to trigger cond_resched() in kernel space.

The removed code includes:
- Declaration and increment of the 'count' variable.
- Conditional invocation of cmp() based on 'count'.

This cleanup simplifies merge_final(), avoids unnecessary overhead, and has no impact on the functionality of list_sort() in userspace.

Cc Adrian Hunter <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ching-Chun (Jim) Huang <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>

---

 tools/lib/list_sort.c |   10 ----------
 1 file changed, 10 deletions(-)
tools/lib/list_sort.c renamed from tools/lib/list_sort.c~tools-lib-list_sort-remove-redundant-code-for-cond_resched-handling +0 -10
@@ -52,7 +52,6 @@ static void merge_final(void *priv, list
 			struct list_head *a, struct list_head *b)
 {
 	struct list_head *tail = head;
-	u8 count = 0;
 
 	for (;;) {
 		/* if equal, take 'a' -- important for sort stability */
@@ -78,15 +77,6 @@ static void merge_final(void *priv, list
 	/* Finish linking remainder of list b on to tail */
 	tail->next = b;
 	do {
-		/*
-		 * If the merge is highly unbalanced (e.g. the input is
-		 * already sorted), this loop may run many iterations.
-		 * Continue callbacks to the client even though no
-		 * element comparison is needed, so the client's cmp()
-		 * routine can invoke cond_resched() periodically.
-		 */
-		if (unlikely(!++count))
-			cmp(priv, b, b);
 		b->prev = tail;
 		tail = b;
 		b = b->next;

_

Patches currently in -mm which might be from [email protected] are