lkml.org 
[lkml]   [2020]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] arm64: scs: Store absolute SCS stack pointer value in thread_info
On Fri, May 15, 2020 at 06:27:51PM +0100, Will Deacon wrote:
> Storing the SCS information in thread_info as a {base,offset} pair
> introduces an additional load instruction on the ret-to-user path,
> since the SCS stack pointer in x18 has to be converted back to an offset
> by subtracting the base.
>
> Replace the offset with the absolute SCS stack pointer value instead
> and avoid the redundant load.
>
> Signed-off-by: Will Deacon <will@kernel.org>

One trivial nit below, but regardless this looks sound to me, and I
certainly prefer having the absolute address rather than an offset, so:

Reviewed-by: Mark Rutland <mark.rutland@arm.com>

> diff --git a/kernel/scs.c b/kernel/scs.c
> index 9389c28f0853..5ff8663e4a67 100644
> --- a/kernel/scs.c
> +++ b/kernel/scs.c
> @@ -60,8 +60,7 @@ int scs_prepare(struct task_struct *tsk, int node)
> if (!s)
> return -ENOMEM;
>
> - task_scs(tsk) = s;
> - task_scs_offset(tsk) = 0;
> + task_scs(tsk) = task_scs_sp(tsk) = s;

I think this would be more legible as two statements:

| task_sys(tsk) = s;
| task_scs_sp(tsk) = s;

... as we usually save `foo = bar = baz` stuff for the start of a
function or within loop conditions.

Thanks,
Mark.

> scs_account(tsk, 1);
> return 0;
> }
> --
> 2.26.2.761.g0e0b3e54be-goog
>

\
 
 \ /
  Last update: 2020-05-18 13:38    [W:0.429 / U:1.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site