Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2018 13:45:15 -0700
From:      Matthew Macy <mmacy@freebsd.org>
To:        Eric van Gyzen <eric@vangyzen.net>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r333859 - head/sys/kern
Message-ID:  <CAPrugNpuEKuhWN0-eZyQfCH2aM8iXr_8WDCKkcEvjq9RpCaAfw@mail.gmail.com>
In-Reply-To: <e1e03916-b54a-8d8f-e3a0-3f96c3dad84e@vangyzen.net>
References:  <201805190509.w4J59Atx053545@repo.freebsd.org> <e1e03916-b54a-8d8f-e3a0-3f96c3dad84e@vangyzen.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Bear in mind that prior to my change most functions would call it
without ever using it on non-debug builds.

On Mon, May 21, 2018 at 9:54 AM, Eric van Gyzen <eric@vangyzen.net> wrote:
> 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?CAPrugNpuEKuhWN0-eZyQfCH2aM8iXr_8WDCKkcEvjq9RpCaAfw>