Messages in this thread | | | From | "Manfred Spraul" <> | Subject | Re: (*(unsigned long *)&jiffies)++; | Date | Thu, 6 Jan 2000 18:00:47 +0100 |
| |
From: "Tigran Aivazian" <tigran@sco.COM> > On Thu, 6 Jan 2000, Petko Manolov wrote: > > Exactly. > > "(*(unsigned long *)&jiffies)++" did just "incl jiffies" > > at the time and in the place you write it. > > Ok. Why is it not done for lost_ticks and lost_ticks_system? > I don't know. I just checked my source archive: linux-1.2.13 uses "jiffies++", and 2.0.38 uses "(*(...))".
I don't know why this cast was added, but it doesn't enforce atomicity on SMP computers. _If_ we really need the atomicity, then something like this could fix the problem:
- unsigned long volatile jiffies = 0; +atomic_t atomic_jiffies = ATOMIC_INIT(0);
+ #define INC_JIFFIES() atomic_inc(&atomic_jiffies); + #defien ADD_JIFFIES(inc) atomci_add(&atomic_jiffies,inc); + #define jiffies ((unsigned long) atomic_get(&atomic_jiffies));
Warning: I never tried that, I didn't check if it will be correct on 64-bit archs, ...
-- Manfred
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |