Re: [PATCH v3 09/15] arm64/mm: Split the function check_and_switch_context in 3 parts
From: Catalin Marinas
Date: Thu Jul 25 2019 - 14:08:26 EST
On Wed, Jul 24, 2019 at 05:25:28PM +0100, Julien Grall wrote:
> The function check_and_switch_context is used to:
> 1) Check whether the ASID is still valid
> 2) Generate a new one if it is not valid
> 3) Switch the context
>
> While the latter is specific to the MM subsystem, the rest could be part
> of the generic ASID allocator.
>
> After this patch, the function is now split in 3 parts which corresponds
> to the use of the functions:
> 1) asid_check_context: Check if the ASID is still valid
> 2) asid_new_context: Generate a new ASID for the context
> 3) check_and_switch_context: Call 1) and 2) and switch the context
>
> 1) and 2) have not been merged in a single function because we want to
> avoid to add a branch in when the ASID is still valid. This will matter
> when the code will be moved in separate file later on as 1) will reside
> in the header as a static inline function.
>
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
>
> ---
> Will wants to avoid to add a branch when the ASID is still valid. So
> 1) and 2) are in separates function. The former will move to a new
> header and make static inline.
Was this discussion logged somewhere, just to get the context?
I presume by "branch" you meant the function call to
asid_check_context(). Personally, I don't like the duplication of this
function in patch 13. This is part of the ASID allocation algorithm and
I prefer to keep them together (we even had a bug in here with the xchg
use).
Do you have any numbers to show how non-inlining this function affects
the performance (hackbench -P would do).
--
Catalin