lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1509427662-25114-3-git-send-email-atish.patra@oracle.com>
Date:   Tue, 31 Oct 2017 00:27:42 -0500
From:   Atish Patra <atish.patra@...cle.com>
To:     linux-kernel@...r.kernel.org
Cc:     atish.patra@...cle.com, joelaf@...gle.com, peterz@...radead.org,
        brendan.jackman@....com, jbacik@...com, mingo@...hat.com
Subject: [PATCH DEBUG 2/2] sched: Add a stat for idle cpu selection race window.

This is ** Debug ** only patch not intended for merging.

A new stat in schedstat is added that represents number of
times cpu was already claimed during wakeup while some other
cpu tries to schedule tasks on it again. It helps to verify
if the concerned issue is present in a specific becnhmark.

Tested-by: Joel Fernandes <joelaf@...gle.com>
Signed-off-by: Atish Patra <atish.patra@...cle.com>
---
 kernel/sched/core.c  | 4 +++-
 kernel/sched/sched.h | 1 +
 kernel/sched/stats.c | 5 +++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d9d501c..d12b8c8 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3918,8 +3918,10 @@ int idle_cpu(int cpu)
 		return 0;
 #endif
 
-	if (per_cpu(claim_wakeup, cpu))
+	if (per_cpu(claim_wakeup, cpu)) {
+		schedstat_inc(rq->ttwu_claimed);
 		return 0;
+	}
 
 	return 1;
 }
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 5f70b98..8f3047c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -801,6 +801,7 @@ struct rq {
 	/* try_to_wake_up() stats */
 	unsigned int ttwu_count;
 	unsigned int ttwu_local;
+	unsigned int ttwu_claimed;
 #endif
 
 #ifdef CONFIG_SMP
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
index 87e2c9f..2290aa7 100644
--- a/kernel/sched/stats.c
+++ b/kernel/sched/stats.c
@@ -30,12 +30,13 @@ static int show_schedstat(struct seq_file *seq, void *v)
 
 		/* runqueue-specific stats */
 		seq_printf(seq,
-		    "cpu%d %u 0 %u %u %u %u %llu %llu %lu",
+		    "cpu%d %u 0 %u %u %u %u %llu %llu %lu %u",
 		    cpu, rq->yld_count,
 		    rq->sched_count, rq->sched_goidle,
 		    rq->ttwu_count, rq->ttwu_local,
 		    rq->rq_cpu_time,
-		    rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount);
+		    rq->rq_sched_info.run_delay,
+		    rq->rq_sched_info.pcount, rq->ttwu_claimed);
 
 		seq_printf(seq, "\n");
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ