* Initialize n mutexes for use when searching and inserting * into "istate->dir_hash". All "dir" threads are trying * to insert partial pathnames into the hash as they iterate * over their portions of the index, so lock contention is * high. * * However, the hashmap is going to put items into bucket * chains based on their hash values. Use that to create n * mutexes and lock on mutex[buc
| 236 | * decrease the collision rate by (hopefully) a factor of n. |
| 237 | */ |
| 238 | static void init_dir_mutex(void) |
| 239 | { |
| 240 | int j; |
| 241 | |
| 242 | CALLOC_ARRAY(lazy_dir_mutex_array, LAZY_MAX_MUTEX); |
| 243 | |
| 244 | for (j = 0; j < LAZY_MAX_MUTEX; j++) |
| 245 | init_recursive_mutex(&lazy_dir_mutex_array[j]); |
| 246 | } |
| 247 | |
| 248 | static void cleanup_dir_mutex(void) |
| 249 | { |
no test coverage detected