From 61a74c5ccd65d1a00a96779f16eda8c41ff3a426 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Sun, 15 Dec 2019 21:11:15 +0000 Subject: schedlock 1/4 Eliminate recursion from most thread_lock consumers. Return from sched_add() without the thread_lock held. This eliminates unnecessary atomics and lock word loads as well as reducing the hold time for scheduler locks. This will eventually allow for lockless remote adds. Discussed with: kib Reviewed by: jhb Tested by: pho Differential Revision: https://reviews.freebsd.org/D22626 --- sys/compat/linux/linux_fork.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sys/compat/linux/linux_fork.c') diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 066640e2fc9c5..0c772ea5cb4a1 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -92,7 +92,6 @@ linux_fork(struct thread *td, struct linux_fork_args *args) thread_lock(td2); TD_SET_CAN_RUN(td2); sched_add(td2, SRQ_BORING); - thread_unlock(td2); return (0); } @@ -123,7 +122,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args *args) thread_lock(td2); TD_SET_CAN_RUN(td2); sched_add(td2, SRQ_BORING); - thread_unlock(td2); return (0); } @@ -228,7 +226,6 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args) thread_lock(td2); TD_SET_CAN_RUN(td2); sched_add(td2, SRQ_BORING); - thread_unlock(td2); td->td_retval[0] = p2->p_pid; @@ -343,7 +340,6 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args) thread_lock(newtd); TD_SET_CAN_RUN(newtd); sched_add(newtd, SRQ_BORING); - thread_unlock(newtd); td->td_retval[0] = newtd->td_tid; -- cgit v1.2.3