public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: don't output cpu sched info by default
@ 2016-04-25  5:04 Zhang Long
  2016-04-25 10:49 ` Afzal Mohammed
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Long @ 2016-04-25  5:04 UTC (permalink / raw)
  To: mingo, peterz, linux-kernel; +Cc: Zhang, Yanmin

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-26  6:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25  5:04 [PATCH] sched: don't output cpu sched info by default Zhang Long
2016-04-25 10:49 ` Afzal Mohammed
2016-04-26  1:04   ` Zhang, Yanmin
2016-04-26  6:39   ` Zhang, Yanmin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox