[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e7f7afb177049ac9f8e7223f19e8767@AcuMS.aculab.com>
Date: Tue, 4 Jun 2019 10:42:20 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Christian Brauner' <christian@...uner.io>,
David Howells <dhowells@...hat.com>
CC: "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
"jannh@...gle.com" <jannh@...gle.com>,
"keescook@...omium.org" <keescook@...omium.org>,
"fweimer@...hat.com" <fweimer@...hat.com>,
"oleg@...hat.com" <oleg@...hat.com>,
"arnd@...db.de" <arnd@...db.de>,
"Pavel Emelyanov" <xemul@...tuozzo.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Adrian Reber <adrian@...as.de>,
Andrei Vagin <avagin@...il.com>,
"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>
Subject: RE: [PATCH v2 1/2] fork: add clone3
From: Christian Brauner
> Sent: 04 June 2019 10:43
...
> > > + u64 clone_flags = args->flags;
> > > + int __user *child_tidptr = args->child_tid;
> > > + unsigned long tls = args->tls;
> > > + unsigned long stack_start = args->stack;
> > > + unsigned long stack_size = args->stack_size;
> >
> > Some of these are only used once, so it's probably not worth sticking them in
> > local variables.
>
> [1]:
> Ok, will double check.
> This was just to minimize copy-paste erros for variables which were used
> multiple times.
Even the ones that are used multiple times may be better being
repeatedly read from args->xxx.
If you are "lucky" 'args' will be in a register variables
so all the accesses are cheap.
With too many locals everything gets copied onto the actual
stack - especially likely if there are any function calls
(that might conceivably change *args) after the locals
are initialised.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists