lkml.org 
[lkml]   [2017]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2017-07-31 17:46    [W:0.204 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site