public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhang Long <longx.zhang@intel.com>
To: mingo@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org
Cc: "Zhang, Yanmin" <yanmin.zhang@intel.com>
Subject: [PATCH] sched: don't output cpu sched info by default
Date: Mon, 25 Apr 2016 13:04:41 +0800	[thread overview]
Message-ID: <571DA569.5040701@intel.com> (raw)

From: LongX Zhang <longx.zhang@intel.com>

Users usually install dozens of apps on Android devices.
When system memory is used up as thousands of threads might run,
Android userspace debug prcoess might dump system info by sysrq.
One info is of cpu sched. Usually, one thread has one line dump.
Such log is huge sometimes and such dumping spends lots of time
and make the system worse. Sometimes, watchdog resets the system
in the end.

The patch fixes it by dumping cpu sched info only when
sched_debug_enabled is true.

Signed-off-by: Zhang Yanmin <yanmin_zhang@linux.intel.com>
Signed-off-by: LongX Zhang <longx.zhang@intel.com>
---
 kernel/sched/core.c | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 8b489fc..92d2d83 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4973,6 +4973,25 @@ void sched_show_task(struct task_struct *p)
 	show_stack(p, NULL);
 }
 
+#ifdef CONFIG_SCHED_DEBUG
+
+static __read_mostly int sched_debug_enabled;
+
+static int __init sched_debug_setup(char *str)
+{
+	sched_debug_enabled = 1;
+
+	return 0;
+}
+early_param("sched_debug", sched_debug_setup);
+
+static inline bool sched_debug(void)
+{
+	return sched_debug_enabled;
+}
+
+#endif
+
 void show_state_filter(unsigned long state_filter)
 {
 	struct task_struct *g, *p;
@@ -4998,7 +5017,8 @@ void show_state_filter(unsigned long state_filter)
 	touch_all_softlockup_watchdogs();
 
 #ifdef CONFIG_SCHED_DEBUG
-	sysrq_sched_debug_show();
+	if (sched_debug())
+		sysrq_sched_debug_show();
 #endif
 	rcu_read_unlock();
 	/*
@@ -5499,21 +5519,6 @@ static cpumask_var_t sched_domains_tmpmask; /* sched_domains_mutex */
 
 #ifdef CONFIG_SCHED_DEBUG
 
-static __read_mostly int sched_debug_enabled;
-
-static int __init sched_debug_setup(char *str)
-{
-	sched_debug_enabled = 1;
-
-	return 0;
-}
-early_param("sched_debug", sched_debug_setup);
-
-static inline bool sched_debug(void)
-{
-	return sched_debug_enabled;
-}
-
 static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 				  struct cpumask *groupmask)
 {
-- 
1.9.1

             reply	other threads:[~2016-04-25  4:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25  5:04 Zhang Long [this message]
2016-04-25 10:49 ` [PATCH] sched: don't output cpu sched info by default Afzal Mohammed
2016-04-26  1:04   ` Zhang, Yanmin
2016-04-26  6:39   ` Zhang, Yanmin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571DA569.5040701@intel.com \
    --to=longx.zhang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yanmin.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox