Messages in this thread | | | Date | Mon, 31 Jul 2017 08:45:58 -0700 | From | Davidlohr Bueso <> | Subject | Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys |
| |
On Mon, 31 Jul 2017, Guillaume Knispel wrote:
>ipc_findkey() scanned all objects to look for the wanted key. This is >slow when using a high number of keys, for example on an i5 laptop the >following loop took 17 s, with last semget calls taking ~1 ms each.
I would argue that this is not the common case.
> > for (int i = 0, k=0x424242; i < 31900; ++i) > semget(k++, 1, IPC_CREAT | 0600); > >This change adds an rhashtable of kern_ipc_perm objects in ipc_ids, so >that one lookup cease to be O(n). The above loop now takes ~10 ms. Each >lookup-only semget() call can take between ~120 ns and a few µs. Rarely, >some creations can take a few dozen of µs.
Could you please provide numbers for smaller amounts of keys?
Thanks, Davidlohr
| |