svn commit: r333859 - head/sys/kern

Eric van Gyzen eric at vangyzen.net
Mon May 21 17:00:53 UTC 2018


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


More information about the svn-src-all mailing list