[PATCH] tty: omit need_resched() before cond_resched()

Mikulas Patocka posted 1 patch 2 months, 3 weeks ago
drivers/tty/tty_buffer.c |    3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] tty: omit need_resched() before cond_resched()
Posted by Mikulas Patocka 2 months, 3 weeks ago
There's no need to call need_resched() because cond_resched() will do
nothing if need_resched() returns false.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/tty/tty_buffer.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-2.6/drivers/tty/tty_buffer.c
===================================================================
--- linux-2.6.orig/drivers/tty/tty_buffer.c	2024-03-30 20:07:03.000000000 +0100
+++ linux-2.6/drivers/tty/tty_buffer.c	2025-07-14 18:06:00.000000000 +0200
@@ -499,8 +499,7 @@ static void flush_to_ldisc(struct work_s
 		if (!rcvd)
 			break;
 
-		if (need_resched())
-			cond_resched();
+		cond_resched();
 	}
 
 	mutex_unlock(&buf->lock);