[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200819162403.GF17456@casper.infradead.org>
Date: Wed, 19 Aug 2020 17:24:03 +0100
From: Matthew Wilcox <willy@...radead.org>
To: David Laight <David.Laight@...lab.com>
Cc: "'Eric W. Biederman'" <ebiederm@...ssion.com>,
Christian Brauner <christian.brauner@...ntu.com>,
"peterz@...radead.org" <peterz@...radead.org>,
Christoph Hewllig <hch@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
Jonathan Corbet <corbet@....net>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Tony Luck <tony.luck@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Ley Foon Tan <ley.foon.tan@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"x86@...nel.org" <x86@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Steven Rostedt <rostedt@...dmis.org>,
Stafford Horne <shorne@...il.com>,
Kars de Jong <jongk@...ux-m68k.org>,
Kees Cook <keescook@...omium.org>,
Greentime Hu <green.hu@...il.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Alexandre Chartre <alexandre.chartre@...cle.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Tom Zanussi <zanussi@...nel.org>,
Xiao Yang <yangx.jy@...fujitsu.com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"uclinux-h8-devel@...ts.sourceforge.jp"
<uclinux-h8-devel@...ts.sourceforge.jp>,
"linux-ia64@...r.kernel.org" <linux-ia64@...r.kernel.org>,
"linux-m68k@...ts.linux-m68k.org" <linux-m68k@...ts.linux-m68k.org>,
"sparclinux@...r.kernel.org" <sparclinux@...r.kernel.org>,
"kgdb-bugreport@...ts.sourceforge.net"
<kgdb-bugreport@...ts.sourceforge.net>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH 00/11] Introduce kernel_clone(), kill _do_fork()
On Wed, Aug 19, 2020 at 03:55:47PM +0000, David Laight wrote:
> From: Matthew Wilcox
> > Sent: 19 August 2020 16:45
> >
> > On Wed, Aug 19, 2020 at 03:41:48PM +0000, David Laight wrote:
> > > Does linux have an O(1) (or do I mean o(1)) pid allocator?
> > > Or does it have to do a linear scan to find a gap??
> >
> > O(log(n)). It uses the IDR allocator, so 'n' in this case is the
> > number of PIDs currently allocated, and it's log_64 rather than log_2
> > (which makes no difference to O() but does make a bit of a difference
> > to performance)
>
> Still worse that O(1) - when that is just replacing a variable
> with a value read out of an array.
> Made pid lookup a trivial O(1) as well.
You'd be surprised. We replaced the custom PID allocator with the
generic IDR allocator a few years ago and got a pretty decent speedup.
If you think you can do better, then submit patches. You have to support
all the existing use cases, of course.
Powered by blists - more mailing lists