* Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) wrote:Still thinking about RT : The good news is : we don't really need all those bits to be updated atomically. The bit groups which must be atomically updated are : - Writer and first priority group T writers subscribed count bits 1 bit for writer mutex T reader count bits - For each other priority group : T reader count bits 1 reader exclusion bit (set by the writer) I also noticed that the writer and the first reader priority group happen to be at the same priority level. When the writer want to exclude readers from higher priority groups, it must take their priority, exclude them using the reader exclusion bit, wait for all readers of that group to be out of their critical section and then proceed to the next priority group until all the groups are locked. The reader of the first priority group must check that both the writer mutex and the writers subscribed count bits are not set. The readers in the other groups only have to check the reader exclusion bit associated to their own group. So if we simplify the problem a bit for RT, let's fix a maximum of 32768 threads on the system (15 bits). Let's also assume we have 19 priorities. - Writer and first priority group (fits in 31 bits) 15 bits for writers subscribed count 1 bit for writer mutex 15 bits reader count Then we have an array of 18 : (each fit in 16 bits) 15 reader count bits 1 reader exclusion bit Therefore, the whole data would fit in 40 bytes. The only thing we would not have is the ability to do a single cmpxchg on all the bits in the writer fast path, making the writer common case much much slower. However, the reader side would still be lightning-fast as it would only have to do a cmpxchg on its own 16 or 32 bits bitfield. Mathieu -- Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 --
| Parag Warudkar | BUG: soft lockup - CPU#1 stuck for 15s! [swapper:0] |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Arjan van de Ven | Re: [GIT]: Networking |
| David Miller | Re: [BUG] New Kernel Bugs |
