On Wed, May 29, 2013 at 1:18 AM, Ryan Stone <rysto32_at_gmail.com> wrote: > On Tue, May 28, 2013 at 5:29 PM, Ian Lepore <ian_at_freebsd.org> wrote: >> >> ticks is defined as a signed integer but conceptually it is unsigned -- >> it increments from 0 to UINT_MAX (not INT_MAX) then rolls over. If >> td->td_blktick is captured while ticks = UINT_MAX and later ticks has >> rolled over and counted back up to 15, then ticks - td->td_blktick gives >> an elapsed time of 16, as it should be. Whether exploiting this >> property of signed overflow is elegant or ugly is in the eye of the >> beholder. :) >> >> If the intent of the "ticks < td->td_blktick" is to avoid the deadlock >> check until "after enough time has passed," then I guess it should >> probably be something more like "(ticks - td->blktick) > SOME_THRESHOLD" >> so that it also uses the signed overflow trick. >> >> -- Ian > > > It already does this later on to actually detect the deadlock. The test is > reversed but was intended to bail and not calculate the time elapsed at all > if ticks had overflowed after td_blktick was captured, but as you say this > is unnecessary. I'm not sure if there was a comparison between the 2 values (ticks, td_slpticks) somewhere, but if there is not and only add/sub to the relative values then it is good to be removed. Attilio -- Peace can only be achieved by understanding - A. EinsteinReceived on Tue May 28 2013 - 21:31:14 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:38 UTC