Messages in this thread | | | Date | Tue, 13 Oct 1998 10:00:50 -0700 (PDT) | From | Tim Smith <> | Subject | Re: 2.1.125 Show stopper list: Draft |
| |
On Tue, 13 Oct 1998, Andrea Arcangeli wrote: > On Sun, 11 Oct 1998, Alan Cox wrote: > > Jiffy Handling > > Many drivers still do not handle jiffy overflows nicely > > Alan, should we consider this really a bug? I think that to only _clean_ > way to fix this problem would be to use a long long C type for jiffies > (decreasing performance). But decreasing performance is needed also to > catch the overflow...
You can push overflow processing off onto the readers of a counter, so that it doesn't hurt performance of the writers of a counter:
writer:
/* assuming 32-bit longs */ unsigned long counter_low; /* low 24 bits */ unsigned long counter_high; /* high 32 bits */ ... ++counter_low;
reader: long long counter_value;
if ( counter_low & 0xFF000000 ) { counter_high += counter_low >> 24; counter_low &= 0x00FFFFFF; } counter_value = ((long long)counter_high << 24) + counter_low;
This only gives you a 56 bit counter, not a 64 bit counter, and it assumes that someone reads the counter often enough for the overflow processing to keep counter_low from overflowing, but that usually can be arranged.
--Tim Smith
- 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/
| |