Move the LW_BOUND flag into the thread-private flag word. It can be tested
by other threads/CPUs but that is only done when the LWP is known to be in a quiescent state (for example, on a run queue).
This commit is contained in:
parent
06e0894e76
commit
b60416c0e2
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_cpu.c,v 1.25 2008/04/12 17:02:08 ad Exp $ */
|
||||
/* $NetBSD: kern_cpu.c,v 1.26 2008/04/12 17:16:09 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.25 2008/04/12 17:02:08 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.26 2008/04/12 17:16:09 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -295,7 +295,7 @@ cpu_xc_offline(struct cpu_info *ci)
|
||||
|
||||
/* Handle LSRUN and LSIDL cases */
|
||||
LIST_FOREACH(l, &alllwp, l_list) {
|
||||
if (l->l_cpu != ci || (l->l_flag & LW_BOUND))
|
||||
if (l->l_cpu != ci || (l->l_pflag & LP_BOUND))
|
||||
continue;
|
||||
if (l->l_stat == LSRUN && (l->l_flag & LW_INMEM) != 0) {
|
||||
sched_dequeue(l);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_kthread.c,v 1.21 2008/02/14 14:26:57 ad Exp $ */
|
||||
/* $NetBSD: kern_kthread.c,v 1.22 2008/04/12 17:16:09 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2007 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.21 2008/02/14 14:26:57 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.22 2008/04/12 17:16:09 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -111,7 +111,7 @@ kthread_create(pri_t pri, int flag, struct cpu_info *ci,
|
||||
lwp_unlock_to(l, ci->ci_schedstate.spc_mutex);
|
||||
lwp_lock(l);
|
||||
}
|
||||
l->l_flag |= LW_BOUND;
|
||||
l->l_pflag |= LP_BOUND;
|
||||
l->l_cpu = ci;
|
||||
}
|
||||
if ((flag & KTHREAD_INTR) != 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_synch.c,v 1.223 2008/04/12 17:02:08 ad Exp $ */
|
||||
/* $NetBSD: kern_synch.c,v 1.224 2008/04/12 17:16:09 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -101,7 +101,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.223 2008/04/12 17:02:08 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.224 2008/04/12 17:16:09 ad Exp $");
|
||||
|
||||
#include "opt_kstack.h"
|
||||
#include "opt_lockdebug.h"
|
||||
@ -1214,7 +1214,7 @@ sched_enqueue(struct lwp *l, bool swtch)
|
||||
}
|
||||
TAILQ_INSERT_TAIL(q_head, l, l_runq);
|
||||
ci_rq->r_count++;
|
||||
if ((l->l_flag & LW_BOUND) == 0)
|
||||
if ((l->l_pflag & LP_BOUND) == 0)
|
||||
ci_rq->r_mcount++;
|
||||
|
||||
/*
|
||||
@ -1254,7 +1254,7 @@ sched_dequeue(struct lwp *l)
|
||||
KASSERT(ci_rq->r_count > 0);
|
||||
|
||||
ci_rq->r_count--;
|
||||
if ((l->l_flag & LW_BOUND) == 0)
|
||||
if ((l->l_pflag & LP_BOUND) == 0)
|
||||
ci_rq->r_mcount--;
|
||||
|
||||
q_head = sched_getrq(ci_rq, eprio);
|
||||
@ -1344,7 +1344,7 @@ sched_takecpu(struct lwp *l)
|
||||
ci_rq = spc->spc_sched_info;
|
||||
|
||||
/* If thread is strictly bound, do not estimate other CPUs */
|
||||
if (l->l_flag & LW_BOUND)
|
||||
if (l->l_pflag & LP_BOUND)
|
||||
return ci;
|
||||
|
||||
/* CPU of this thread is idling - run there */
|
||||
@ -1450,7 +1450,7 @@ sched_catchlwp(void)
|
||||
KASSERT(l->l_flag & LW_INMEM);
|
||||
|
||||
/* Look for threads, whose are allowed to migrate */
|
||||
if ((l->l_flag & LW_BOUND) || lwp_cache_hot(l) ||
|
||||
if ((l->l_pflag & LP_BOUND) || lwp_cache_hot(l) ||
|
||||
!sched_migratable(l, curci)) {
|
||||
l = TAILQ_NEXT(l, l_runq);
|
||||
continue;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_prf.c,v 1.116 2008/02/19 07:46:51 dogcow Exp $ */
|
||||
/* $NetBSD: subr_prf.c,v 1.117 2008/04/12 17:16:09 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1986, 1988, 1991, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.116 2008/02/19 07:46:51 dogcow Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.117 2008/04/12 17:16:09 ad Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_ipkdb.h"
|
||||
@ -201,7 +201,7 @@ panic(const char *fmt, ...)
|
||||
* CPUs from scheduling unbound jobs. Do so without taking any
|
||||
* locks.
|
||||
*/
|
||||
curlwp->l_flag |= LW_BOUND;
|
||||
curlwp->l_pflag |= LP_BOUND;
|
||||
for (CPU_INFO_FOREACH(cii, ci)) {
|
||||
ci->ci_schedstate.spc_flags |= SPCF_OFFLINE;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lwp.h,v 1.86 2008/04/12 17:02:09 ad Exp $ */
|
||||
/* $NetBSD: lwp.h,v 1.87 2008/04/12 17:16:09 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -208,7 +208,6 @@ extern lwp_t lwp0; /* LWP for proc0 */
|
||||
#define LW_WREBOOT 0x08000000 /* System is rebooting, please suspend */
|
||||
#define LW_UNPARKED 0x10000000 /* Unpark op pending */
|
||||
#define LW_RUNNING 0x20000000 /* Active on a CPU (except if LSZOMB) */
|
||||
#define LW_BOUND 0x80000000 /* Bound to a CPU */
|
||||
|
||||
/* The second set of flags is kept in l_pflag. */
|
||||
#define LP_KTRACTIVE 0x00000001 /* Executing ktrace operation */
|
||||
@ -219,6 +218,7 @@ extern lwp_t lwp0; /* LWP for proc0 */
|
||||
#define LP_MPSAFE 0x00000020 /* Starts life without kernel_lock */
|
||||
#define LP_INTR 0x00000040 /* Soft interrupt handler */
|
||||
#define LP_SYSCTLWRITE 0x00000080 /* sysctl write lock held */
|
||||
#define LP_BOUND 0x80000000 /* Bound to a CPU */
|
||||
|
||||
/* The third set is kept in l_prflag. */
|
||||
#define LPR_DETACHED 0x00800000 /* Won't be waited for. */
|
||||
|
Loading…
Reference in New Issue
Block a user