On Thu, 2008-01-10 at 15:42 -0500, Mathieu Desnoyers wrote:Hmm. I know powerpc has had a similar lock-free dual structure method and for just a raw cycles based method you've shown below (or for some of the bits Steven is working on), I think it should be fine. The concern I've had with this method for general timekeeping, is that I'm not sure it can handle the frequency corrections made by NTP. Since we have to make sure time does not jump backwards, consider this exaggerated situation: time = base + (now - last)*mult; So we have two structures: base: 60 base: 180 last: 10 last: 30 mult: 06 mult: 05 Where the second structure has just been updated lock-free, however just before the atomic pointer switch we were preempted, or somehow delayed, and some time has past. Now imagine two cpus now race to get the time. Both read the same now value, but get different structure pointer values. (Note: You can create the same race if you reverse the order and grab the pointer first, then the cycle. However I think this example makes it easier to understand). now = 50 cpu1: 60 + (50-10)*6 = 300 cpu2: 180 + (50-30)*5 = 280 Alternatively: now=50: 60 + (50-10)*6 = 300 now=51: 180 + (51-30)*5 = 285 Eek. That's not good. I'm not sure how this can be avoided, but I'd be very interested in hearing ideas! Bounding the issue is a possibility, but then starts to run amok with NO_HZ and -rt deferment. thanks -john --
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Linus Torvalds | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| David Newall | Re: Slow DOWN, please!!! |
| Ian Campbell | Re: [PATCH] x86: Construct 32 bit boot time page tables in native format. |
| Matthias Scheler | Re: HEADS UP: timecounters (branch simonb-timecounters) merged into -current |
| Greg Troxel | Re: Interface to change NFS exports |
| Thor Lancelot Simon | metadata cache and memory fragmentation |
| YAMAMOTO Takashi | amap memory allocation |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
| David Miller | [GIT]: Networking |
| Dushan Tcholich | Re: ksoftirqd high cpu load on kernels 2.6.24 to 2.6.27-rc1-mm1 |
