Re: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-10 Thread Christophe Leroy
Le 10/02/2021 à 03:00, Nicholas Piggin a écrit : Excerpts from Christophe Leroy's message of February 10, 2021 3:03 am: Le 09/02/2021 à 15:31, David Laight a écrit : From: Segher Boessenkool Sent: 09 February 2021 13:51 On Tue, Feb 09, 2021 at 12:36:20PM +1000, Nicholas Piggin wrote:

Re: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-09 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of February 10, 2021 3:03 am: > > > Le 09/02/2021 à 15:31, David Laight a écrit : >> From: Segher Boessenkool >>> Sent: 09 February 2021 13:51 >>> >>> On Tue, Feb 09, 2021 at 12:36:20PM +1000, Nicholas Piggin wrote: What if you did this? >>>

RE: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-09 Thread David Laight
From: Christophe Leroy > Sent: 09 February 2021 17:04 > > Le 09/02/2021 à 15:31, David Laight a écrit : > > From: Segher Boessenkool > >> Sent: 09 February 2021 13:51 > >> > >> On Tue, Feb 09, 2021 at 12:36:20PM +1000, Nicholas Piggin wrote: > >>> What if you did this? > >> > >>> +static inline

Re: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-09 Thread Christophe Leroy
Le 09/02/2021 à 15:31, David Laight a écrit : From: Segher Boessenkool Sent: 09 February 2021 13:51 On Tue, Feb 09, 2021 at 12:36:20PM +1000, Nicholas Piggin wrote: What if you did this? +static inline struct task_struct *get_current(void) +{ + register struct task_struct *task

RE: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-09 Thread David Laight
From: Segher Boessenkool > Sent: 09 February 2021 13:51 > > On Tue, Feb 09, 2021 at 12:36:20PM +1000, Nicholas Piggin wrote: > > What if you did this? > > > +static inline struct task_struct *get_current(void) > > +{ > > + register struct task_struct *task asm ("r2"); > > + > > + return

Re: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-09 Thread Segher Boessenkool
On Tue, Feb 09, 2021 at 12:36:20PM +1000, Nicholas Piggin wrote: > What if you did this? > +static inline struct task_struct *get_current(void) > +{ > + register struct task_struct *task asm ("r2"); > + > + return task; > +} Local register asm variables are *only* guaranteed to live in

Re: [PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-08 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of February 9, 2021 1:10 am: > By saving the pointer pointing to thread_info.flags, gcc copies r2 > in a non-volatile register. > > We know 'current' doesn't change, so avoid that intermediaite pointer. > > Reduces null_syscall benchmark by 2 cycles (322

[PATCH v5 20/22] powerpc/syscall: Avoid storing 'current' in another pointer

2021-02-08 Thread Christophe Leroy
By saving the pointer pointing to thread_info.flags, gcc copies r2 in a non-volatile register. We know 'current' doesn't change, so avoid that intermediaite pointer. Reduces null_syscall benchmark by 2 cycles (322 => 320 cycles) On PPC64, gcc seems to know that 'current' is not changing, and it