lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ZsubpFiRXXvkxZzw@grain>
Date: Mon, 26 Aug 2024 00:01:24 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>
Subject: [PATCH] sched/core: Drop unused return code of context_switch()

Since the commit 565790d28b1e @rq returned by finish_task_switch -> context_switch
call chain is not longer used by __schedule() so there is no need to keep it (and
compiler already optimize it out).

CC: Ingo Molnar <mingo@...hat.com>
CC: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@...il.com>
---
Initially I thought there might be some hidden use of @rq returned by finish_task_switch
but didn't notice any even potential future use, thus until I miss something we're safe
to drop this redundant return variable.

 kernel/sched/core.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Index: linux-tip.git/kernel/sched/core.c
===================================================================
--- linux-tip.git.orig/kernel/sched/core.c
+++ linux-tip.git/kernel/sched/core.c
@@ -5088,7 +5088,7 @@ prepare_task_switch(struct rq *rq, struc
  * past. 'prev == current' is still correct but we need to recalculate this_rq
  * because prev may have moved to another CPU.
  */
-static struct rq *finish_task_switch(struct task_struct *prev)
+static void finish_task_switch(struct task_struct *prev)
 	__releases(rq->lock)
 {
 	struct rq *rq = this_rq();
@@ -5168,8 +5168,6 @@ static struct rq *finish_task_switch(str
 
 		put_task_struct_rcu_user(prev);
 	}
-
-	return rq;
 }
 
 /**
@@ -5200,7 +5198,7 @@ asmlinkage __visible void schedule_tail(
 /*
  * context_switch - switch to the new MM and the new thread's register state.
  */
-static __always_inline struct rq *
+static __always_inline void
 context_switch(struct rq *rq, struct task_struct *prev,
 	       struct task_struct *next, struct rq_flags *rf)
 {
@@ -5260,7 +5258,7 @@ context_switch(struct rq *rq, struct tas
 	switch_to(prev, next, prev);
 	barrier();
 
-	return finish_task_switch(prev);
+	finish_task_switch(prev);
 }
 
 /*
@@ -6602,7 +6600,7 @@ static void __sched notrace __schedule(u
 		trace_sched_switch(sched_mode & SM_MASK_PREEMPT, prev, next, prev_state);
 
 		/* Also unlocks the rq: */
-		rq = context_switch(rq, prev, next, &rf);
+		context_switch(rq, prev, next, &rf);
 	} else {
 		rq_unpin_lock(rq, &rf);
 		__balance_callbacks(rq);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ