Re: [PATCH 2/6] scs: Move accounting into alloc/free functions

From: Mark Rutland
Date: Mon May 18 2020 - 07:39:06 EST


On Fri, May 15, 2020 at 06:27:52PM +0100, Will Deacon wrote:
> There's no need to perform the shadow stack page accounting independently
> of the lifetime of the underlying allocation, so call the accounting code
> from the {alloc,free}() functions and simplify the code in the process.
>
> Signed-off-by: Will Deacon <will@xxxxxxxxxx>
> ---
> kernel/scs.c | 45 +++++++++++++++++++++------------------------
> 1 file changed, 21 insertions(+), 24 deletions(-)

One (super trivial) nit below, but regardless this looks like a sound
and sensible cleanup, so:

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

> diff --git a/kernel/scs.c b/kernel/scs.c
> index 5ff8663e4a67..aea841cd7586 100644
> --- a/kernel/scs.c
> +++ b/kernel/scs.c
> @@ -14,25 +14,35 @@

> static void *scs_alloc(int node)
> {

> + void *s = kmem_cache_alloc_node(scs_cache, GFP_SCS, node);
> +
> + if (!s)
> + return NULL;

Super trivial nit, but could we omit the line space between these two,
to fit with usual style?

Mark.