linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Use rcu to lookup a task in mipsmt_sys_sched_setaffinity()
@ 2020-08-31 20:14 Davidlohr Bueso
  2020-09-03  8:24 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2020-08-31 20:14 UTC (permalink / raw)
  To: tsbogend; +Cc: oleg, linux-mips, linux-kernel, dave, Davidlohr Bueso

The call simply looks up the corresponding task (without iterating
the tasklist), which is safe under rcu instead of the tasklist_lock.
In addition, the setaffinity counter part already does this.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 arch/mips/kernel/mips-mt-fpaff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index 1a08428eedcf..6c590ef27648 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -167,7 +167,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
 		return -EINVAL;
 
 	get_online_cpus();
-	read_lock(&tasklist_lock);
+	rcu_read_lock();
 
 	retval = -ESRCH;
 	p = find_process_by_pid(pid);
@@ -181,7 +181,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
 	cpumask_and(&mask, &allowed, cpu_active_mask);
 
 out_unlock:
-	read_unlock(&tasklist_lock);
+	rcu_read_unlock();
 	put_online_cpus();
 	if (retval)
 		return retval;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: Use rcu to lookup a task in mipsmt_sys_sched_setaffinity()
  2020-08-31 20:14 [PATCH] MIPS: Use rcu to lookup a task in mipsmt_sys_sched_setaffinity() Davidlohr Bueso
@ 2020-09-03  8:24 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2020-09-03  8:24 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: oleg, linux-mips, linux-kernel, Davidlohr Bueso

On Mon, Aug 31, 2020 at 01:14:02PM -0700, Davidlohr Bueso wrote:
> The call simply looks up the corresponding task (without iterating
> the tasklist), which is safe under rcu instead of the tasklist_lock.
> In addition, the setaffinity counter part already does this.
> 
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> ---
>  arch/mips/kernel/mips-mt-fpaff.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-03  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 20:14 [PATCH] MIPS: Use rcu to lookup a task in mipsmt_sys_sched_setaffinity() Davidlohr Bueso
2020-09-03  8:24 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).