Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1386008 > unrolled thread

[PATCH] sched: don't output cpu sched info by default

Started byZhang Long <longx.zhang@intel.com>
First post2016-04-25 07:00 +0200
Last post2016-04-26 08:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sched: don't output cpu sched info by default Zhang Long <longx.zhang@intel.com> - 2016-04-25 07:00 +0200
    Re: [PATCH] sched: don't output cpu sched info by default Afzal Mohammed <afzal.mohd.ma@gmail.com> - 2016-04-25 13:00 +0200
      RE: [PATCH] sched: don't output cpu sched info by default "Zhang, Yanmin" <yanmin.zhang@intel.com> - 2016-04-26 03:10 +0200
      RE: [PATCH] sched: don't output cpu sched info by default "Zhang, Yanmin" <yanmin.zhang@intel.com> - 2016-04-26 08:40 +0200

#1386008 — [PATCH] sched: don't output cpu sched info by default

FromZhang Long <longx.zhang@intel.com>
Date2016-04-25 07:00 +0200
Subject[PATCH] sched: don't output cpu sched info by default
Message-ID<rrGMO-8iX-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1386240

FromAfzal Mohammed <afzal.mohd.ma@gmail.com>
Date2016-04-25 13:00 +0200
Message-ID<rrMpd-4ls-23@gated-at.bofh.it>
In reply to#1386008
Hi,

On Mon, Apr 25, 2016 at 01:04:41PM +0800, Zhang Long wrote:

> 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.

Doesn't "sched: don't dump sched debug info in SysRq-W" currently in
tip/sched/core help ?,

http://lkml.kernel.org/r/1459777322-30902-1-git-send-email-rabin.vincent@axis.com

Regards
afzal

[toc] | [prev] | [next] | [standalone]


#1387048

From"Zhang, Yanmin" <yanmin.zhang@intel.com>
Date2016-04-26 03:10 +0200
Message-ID<rrZFM-7e1-13@gated-at.bofh.it>
In reply to#1386240
Thanks for the pointer. We didn't notice that. That patch also
fixes the issue indeed.

Yanmin

-----Original Message-----
From: Afzal Mohammed [mailto:afzal.mohd.ma@gmail.com] 
Sent: Monday, April 25, 2016 6:50 PM
To: Zhang, LongX
Cc: mingo@redhat.com; peterz@infradead.org; linux-kernel@vger.kernel.org; Zhang, Yanmin
Subject: Re: [PATCH] sched: don't output cpu sched info by default

Hi,

On Mon, Apr 25, 2016 at 01:04:41PM +0800, Zhang Long wrote:

> 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.

Doesn't "sched: don't dump sched debug info in SysRq-W" currently in tip/sched/core help ?,

http://lkml.kernel.org/r/1459777322-30902-1-git-send-email-rabin.vincent@axis.com

Regards
afzal

[toc] | [prev] | [next] | [standalone]


#1387167

From"Zhang, Yanmin" <yanmin.zhang@intel.com>
Date2016-04-26 08:40 +0200
Message-ID<rs4P8-2R0-19@gated-at.bofh.it>
In reply to#1386240
I double-check it.
Function show_state_filter chooses to print all tasks when
state_filter == 0 (TASK_RUNNING).
sysrq_sched_debug_show prints per cpu sched debug info.

They are different info.

It is better to use sched_debug_enabled to control the
2nd part output.

Yanmin

-----Original Message-----
From: Zhang, Yanmin 
Sent: Tuesday, April 26, 2016 9:04 AM
To: Afzal Mohammed; Zhang, LongX
Cc: mingo@redhat.com; peterz@infradead.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH] sched: don't output cpu sched info by default

Thanks for the pointer. We didn't notice that. That patch also fixes the issue indeed.

Yanmin

-----Original Message-----
From: Afzal Mohammed [mailto:afzal.mohd.ma@gmail.com]
Sent: Monday, April 25, 2016 6:50 PM
To: Zhang, LongX
Cc: mingo@redhat.com; peterz@infradead.org; linux-kernel@vger.kernel.org; Zhang, Yanmin
Subject: Re: [PATCH] sched: don't output cpu sched info by default

Hi,

On Mon, Apr 25, 2016 at 01:04:41PM +0800, Zhang Long wrote:

> 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.

Doesn't "sched: don't dump sched debug info in SysRq-W" currently in tip/sched/core help ?,

http://lkml.kernel.org/r/1459777322-30902-1-git-send-email-rabin.vincent@axis.com

Regards
afzal

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web