Incorrect comparison of ticks in deadlkres

看板FB_current作者時間12年前 (2013/05/26 06:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/5 (看更多)
Currently deadlkres performs the following comparison when trying to check for threads that have been blocked on a mutex or sleeping on an sx lock: if (TD_ON_LOCK(td) && ticks < td->td_blktick) { /* check for deadlock...*/ The test against ticks is incorrect. It results in deadlkres only signaling a deadlock after ticks has rolled over; at 1000 hz this will take up to 49 days. From looking at the history of the code this test appears to be a attempt to deal with ticks rollover. However this is necessary; later on the code calculates the amount of time that has passed with: tticks = ticks - td->td_blktick; ticks was designed to exploit integer underflow in the case of rollover to guarantee that subtraction produces correct results in all cases (other than a double rollover, of course). I am going to remove the two incorrect tests unless somebody can point out a overflow/underflow case that I haven't considered. _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1HeJIUI4 (FB_current)
文章代碼(AID): #1HeJIUI4 (FB_current)