Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700136

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

From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys
Date 2017-07-31 17:50 +0200
Message-ID <u9l7b-82B-3@gated-at.bofh.it> (permalink)
References <u9eyL-40A-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ipc: optimize semget/shmget/msgget for lots of keys Guillaume Knispel <guillaume.knispel@supersonicimagine.com> - 2017-07-31 10:50 +0200
  Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Davidlohr Bueso <dave@stgolabs.net> - 2017-07-31 17:50 +0200
    Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Guillaume Knispel <guillaume.knispel@supersonicimagine.com> - 2017-08-01 03:20 +0200
      Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Davidlohr Bueso <dave@stgolabs.net> - 2017-08-01 18:00 +0200
  Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Davidlohr Bueso <dave@stgolabs.net> - 2017-08-02 22:10 +0200
    Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Guillaume Knispel <guillaume.knispel@supersonicimagine.com> - 2017-08-03 19:20 +0200
      Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Davidlohr Bueso <dave@stgolabs.net> - 2017-08-07 19:40 +0200
  Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Davidlohr Bueso <dave@stgolabs.net> - 2017-08-07 20:30 +0200
    Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Guillaume Knispel <guillaume.knispel@supersonicimagine.com> - 2017-08-09 18:20 +0200

csiph-web