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

Mark Rutland
2020-05-18T11:39:08Z

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@kernel.org>
> ---
> 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@arm.com>

> 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.