Date: Mon, 2 Dec 2019 22:35:45 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355312 - head/sys/kern Message-ID: <201912022235.xB2MZjAB039553@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Mon Dec 2 22:35:45 2019 New Revision: 355312 URL: https://svnweb.freebsd.org/changeset/base/355312 Log: Initialize the idle thread's lock sooner so it's not evaluated on every fork exit and we can rely on it elsewhere. Reviewed by: mav, kib, jhb, markj Differential Revision: https://reviews.freebsd.org/D22624 Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Mon Dec 2 22:34:19 2019 (r355311) +++ head/sys/kern/sched_ule.c Mon Dec 2 22:35:45 2019 (r355312) @@ -1463,7 +1463,7 @@ sched_setup(void *dummy) /* Add thread0's load since it's running. */ TDQ_LOCK(tdq); - thread0.td_lock = TDQ_LOCKPTR(TDQ_SELF()); + thread0.td_lock = TDQ_LOCKPTR(tdq); tdq_load_add(tdq, &thread0); tdq->tdq_lowpri = thread0.td_priority; TDQ_UNLOCK(tdq); @@ -2913,6 +2913,7 @@ sched_throw(struct thread *td) spinlock_exit(); PCPU_SET(switchtime, cpu_ticks()); PCPU_SET(switchticks, ticks); + PCPU_GET(idlethread)->td_lock = TDQ_LOCKPTR(tdq); } else { tdq = TDQ_SELF(); MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); @@ -2943,8 +2944,6 @@ sched_fork_exit(struct thread *td) */ cpuid = PCPU_GET(cpuid); tdq = TDQ_SELF(); - if (TD_IS_IDLETHREAD(td)) - td->td_lock = TDQ_LOCKPTR(tdq); MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); td->td_oncpu = cpuid; TDQ_LOCK_ASSERT(tdq, MA_OWNED | MA_NOTRECURSED);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912022235.xB2MZjAB039553>