>From 7157c70aed93990f59942d39d1c0d8948164cfe2 Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Thu, 5 Oct 2017 12:34:49 -0400 Subject: [PATCH 2/3] mm: memdelay: idle time is not productive time There is an error in the multi-core logic, where memory delay numbers drop as the number of CPU cores increases. Idle CPUs, even though they don't host delayed processes, shouldn't contribute to the "not delayed" bucket. Because that's the baseline for productivity, and idle CPUs aren't productive. Do not consider idle CPU time in the productivity baseline. Signed-off-by: Johannes Weiner --- include/linux/memdelay.h | 3 ++- mm/memdelay.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/memdelay.h b/include/linux/memdelay.h index d85d01692610..c49f65338c1f 100644 --- a/include/linux/memdelay.h +++ b/include/linux/memdelay.h @@ -24,7 +24,8 @@ enum memdelay_task_state { * productivity states of all tasks inside the domain. */ enum memdelay_domain_state { - MDS_NONE, /* No delayed tasks */ + MDS_IDLE, /* No tasks */ + MDS_NONE, /* Working tasks */ MDS_PART, /* Delayed tasks, working tasks */ MDS_FULL, /* Delayed tasks, no working tasks */ NR_MEMDELAY_DOMAIN_STATES, diff --git a/mm/memdelay.c b/mm/memdelay.c index c7c32dbb67ac..ea5ede79f044 100644 --- a/mm/memdelay.c +++ b/mm/memdelay.c @@ -118,8 +118,10 @@ static void domain_cpu_update(struct memdelay_domain *md, int cpu, else if (mdc->tasks[MTS_DELAYED]) state = (mdc->tasks[MTS_RUNNABLE] || mdc->tasks[MTS_IOWAIT]) ? MDS_PART : MDS_FULL; - else + else if (mdc->tasks[MTS_RUNNABLE] || mdc->tasks[MTS_IOWAIT]) state = MDS_NONE; + else + state = MDS_IDLE; if (mdc->state == state) return; -- 2.14.2