RE: [PATCH v2 1/2] fork: add clone3
From: David Laight
Date: Tue Jun 04 2019 - 06:46:19 EST
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.
> 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
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)