The list of slab cache descriptors (see Section 7.2.2) is protected by the cache_chain_sem semaphore, which grants an exclusive right to access and modify the list.
A race condition is possible when kmem_cache_create( ) adds a new element in the list, while kmem_cache_shrink( ) and kmem_cache_reap( ) sequentially scan the list. However, these functions are never invoked while handling an interrupt, and they can never block while accessing the list. Since the kernel is nonpreemptive, these functions cannot overlap on a uniprocessor system. However, this semaphore plays an active role in multiprocessor systems.
Was this article helpful?