linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Guillaume Knispel <guillaume.knispel@supersonicimagine.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Manfred Spraul <manfred@colorfullife.com>,
	Kees Cook <keescook@chromium.org>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Serge Hallyn <serge@hallyn.com>, Andrey Vagin <avagin@openvz.org>,
	Marc Pardo <marc.pardo@supersonicimagine.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipc: optimize semget/shmget/msgget for lots of keys
Date: Mon, 31 Jul 2017 08:45:58 -0700	[thread overview]
Message-ID: <20170731154558.GB21328@linux-80c1.suse> (raw)
In-Reply-To: <20170731084237.GA123231@ubuntu>

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

  reply	other threads:[~2017-07-31 15:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31  8:42 [PATCH] ipc: optimize semget/shmget/msgget for lots of keys Guillaume Knispel
2017-07-31 15:45 ` Davidlohr Bueso [this message]
2017-08-01  1:17   ` Guillaume Knispel
2017-08-01 15:51     ` Davidlohr Bueso
2017-08-02 20:06 ` Davidlohr Bueso
2017-08-03 17:14   ` Guillaume Knispel
2017-08-07 17:33     ` Davidlohr Bueso
2017-08-07 18:21 ` Davidlohr Bueso
2017-08-09 16:15   ` Guillaume Knispel
2017-08-14  6:05 ` [lkp-robot] [ipc] cb6268f05d: reaim.jobs_per_min 865% improvement kernel test robot
2017-08-14 17:59   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170731154558.GB21328@linux-80c1.suse \
    --to=dave@stgolabs.net \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@openvz.org \
    --cc=bigeasy@linutronix.de \
    --cc=ebiederm@xmission.com \
    --cc=guillaume.knispel@supersonicimagine.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=marc.pardo@supersonicimagine.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).