I have been looking at file locking for 8.0 and have come up with a way to completely eliminate the file lock, reduce the size of struct file by ~4 pointers (22%), remove the global list of files and associated lock, and restrict the scope of unp_gc while removing several race conditions.
The whole thing hinges on reducing the complexity and scope of unp_gc to remove several fields from struct file. The remaining parts can be protected by atomics or are already protected by other locks. f_count and f_type are now completely updated using atomics. The ref counting with atomics results in significantly fewer atomics and cheaper fhold/fdrop. Protecting f_type was only complicated in cases where there were compound operations done on it, which are now implemented with atomic_cmpset_int loops.
(more...)
No hay comentarios:
Publicar un comentario