[RHEL7,COMMIT] vz_latency: don't account allocations in interrupts to random tasks

Submitted by Konstantin Khorenko on Aug. 31, 2018, 10:23 a.m.


Message ID 201808311023.w7VANjOR004355@finist_ce7.work
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko Aug. 31, 2018, 10:23 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.11.6.vz7.71.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.11.6.vz7.71.6
commit 42547a1f5ab1dc27277cdd1778c9ad823c0e3d53
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Fri Aug 31 13:23:45 2018 +0300

    vz_latency: don't account allocations in interrupts to random tasks
    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
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Reviewed-by: Denis V. Lunev <den@openvz.org>
 mm/page_alloc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0038474f6c82..179bb0c351b2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3234,8 +3234,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)