Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Dec 2005 11:19:53 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Joseph Koshy <joseph.koshy@gmail.com>
Cc:        Luigi Rizzo <rizzo@icir.org>, freebsd-current@freebsd.org
Subject:   Re: td->td_critnest manipulations do not use atomic_add_int ?
Message-ID:  <200512211119.54940.jhb@freebsd.org>
In-Reply-To: <84dead720512201904q6dbe5e6er6925282d4d320bee@mail.gmail.com>
References:  <20051220032538.A33093@xorpc.icir.org> <200512201422.47323.jhb@freebsd.org> <84dead720512201904q6dbe5e6er6925282d4d320bee@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 20 December 2005 10:04 pm, Joseph Koshy wrote:
> lr> is td ever != curthread?
>
> jhb> No.
>
> I don't think we KASSERT() this in enough places in the code
> though.

void
critical_enter(void)
{
	struct thread *td;

	td = curthread;
	td->td_critnest++;
	CTR4(KTR_CRITICAL, "critical_enter by thread %p (%ld, %s) to %d", td,
	    (long)td->td_proc->p_pid, td->td_proc->p_comm, td->td_critnest);
}

void
critical_exit(void)
{
	struct thread *td;

	td = curthread;
	KASSERT(td->td_critnest != 0,
	..
}

Need I say more?  Clearly td == curthread.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512211119.54940.jhb>