Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2018 11:54:14 -0500
From:      Eric van Gyzen <eric@vangyzen.net>
To:        Matt Macy <mmacy@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r333859 - head/sys/kern
Message-ID:  <e1e03916-b54a-8d8f-e3a0-3f96c3dad84e@vangyzen.net>
In-Reply-To: <201805190509.w4J59Atx053545@repo.freebsd.org>
References:  <201805190509.w4J59Atx053545@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 05/19/2018 00:09, Matt Macy wrote:
> @@ -1663,16 +1655,18 @@ static int
>  umtxq_sleep_pi(struct umtx_q *uq, struct umtx_pi *pi, uint32_t owner,
>      const char *wmesg, struct abs_timeout *timo, bool shared)
>  {
> -	struct umtxq_chain *uc;
>  	struct thread *td, *td1;
>  	struct umtx_q *uq1;
>  	int error, pri;
> +#ifdef INVARIANTS
> +	struct umtxq_chain *uc;
>  
> +	uc = umtxq_getchain(&pi->pi_key);
> +#endif
>  	error = 0;
>  	td = uq->uq_thread;
>  	KASSERT(td == curthread, ("inconsistent uq_thread"));
> -	uc = umtxq_getchain(&uq->uq_key);
> -	UMTXQ_LOCKED_ASSERT(uc);
> +	UMTXQ_LOCKED_ASSERT(umtxq_getchain(&uq->uq_key));

Couldn't this line stay as it was?

	UMTXQ_LOCKED_ASSERT(uc);

With the current code, we're calling umtxq_getchain() once more than
necessary.  Also, the casual reader might be confused by calling it with
two different arguments.

Eric



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e1e03916-b54a-8d8f-e3a0-3f96c3dad84e>