[Devel] [PATCH RH8 5/8] vz_latency: don't account allocations in interrupts to random tasks

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 24 20:13:23 MSK 2021


Merged into previous patch.

f221a0258c4a ve/page_alloc, kstat: account allocation latencies per-task and per-thread

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 05/18/2021 08:48 PM, Andrey Zhadchenko wrote:
> From: Andrey Ryabinin <aryabinin at virtuozzo.com>
>
> When we in interrupt, the 'current' is just any random task. We shouldn't
> account per-task atomic allocations latency to random tasks. Use in_task()
> macro to identify task context, and account per-task latency iff we in
> task.
>
> https://jira.sw.ru/browse/PSBM-87797
> Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
>
> Reviewed-by: Denis V. Lunev <den at openvz.org>
>
> (cherry-picked from 3ed23cb6c686fab5bc6b36e1e7170e07a7ee788b)
> Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
> ---
>  mm/page_alloc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 2d8365e..e430fda 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4537,8 +4537,10 @@ static void __alloc_collect_stats(gfp_t gfp_mask, unsigned int order,
>  	cpu = smp_processor_id();
>  	KSTAT_LAT_PCPU_ADD(&kstat_glob.alloc_lat[ind], time);
>
> -	current->alloc_lat[ind].totlat += time;
> -	current->alloc_lat[ind].count++;
> +	if (in_task()) {
> +		current->alloc_lat[ind].totlat += time;
> +		current->alloc_lat[ind].count++;
> +	}
>
>  	if (!page)
>  		kstat_glob.alloc_fails[cpu][ind]++;
>


More information about the Devel mailing list