Messages in this thread |  | | From | "Petr Vandrovec" <> | Date | Thu, 1 Nov 2001 09:02:44 MET-1 | Subject | Re: [Patch] Re: Nasty suprise with uptime |
| |
On 1 Nov 01 at 1:52, Tim Schmielau wrote:
> + static unsigned long jiffies_hi = 0; > + static unsigned long jiffies_last = INITIAL_JIFFIES; > + unsigned long jiffies_tmp; > + > + jiffies_tmp = jiffies; /* avoid races */ > + if (jiffies_tmp < jiffies_last) /* We have a wrap */ > + jiffies_hi++; > + jiffies_last = jiffies_tmp;
There is very small race - if two processes will call get_jiffies64() at same time, they can both happen to test jiffies_tmp < jiffies_last with old jiffies_last - incrementing jiffies_hi twice :-( This race window is only few microseconds every 497 days, but if we want correct kernel... Best regards, Petr Vandrovec vandrove@vc.cvut.cz
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |