Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys

From: Davidlohr Bueso
Date: Wed Aug 02 2017 - 16:07:05 EST

On Mon, 31 Jul 2017, Guillaume Knispel wrote:
static int __init ipc_init(void)
- sem_init();
- msg_init();
+ int err_sem, err_msg;
+ err_sem = sem_init();
+ WARN(err_sem, "ipc: sysV sem_init failed: %d\n", err_sem);
+ err_msg = msg_init();
+ WARN(err_msg, "ipc: sysV msg_init failed: %d\n", err_msg);

This shows the ugliness of the underlying ipc init asymmetry. Specifically,
140d0b2108f (Do 'shm_init_ns()' in an early pure_initcall) was the final
nail in the coffin to fix an exit_shm() race.

While normally we could just initialize the ipc_ids fields statically and
be over with initcall dependencies, your patch will require inits be done
dynamically for the rhashtable_init(). Oh well.

Also, why do you do this?