mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: "M. Vefa Bicakci" <bicave@superonline.com>
Cc: kosaki.motohiro@jp.fujitsu.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [Bisected Regression in 2.6.35] A full tmpfs filesystem causes hibernationto hang
Date: Sun, 22 Aug 2010 20:06:24 +0900 (JST)	[thread overview]
Message-ID: <20100820115449.5FF1.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <4C677A49.4030904@superonline.com>

[-- Attachment #1: Type: text/plain, Size: 2297 bytes --]

> Hello all,
> 
> I am using Debian Sid on a Toshiba Satellite A100 laptop. After testing
> 2.6.35 for a while, I noticed that sometimes my hibernation attempts
> would fail. I should say that I never had such a problem before 2.6.35.
> The hibernation process hangs with 2.6.35 after printing the following:
> 
> === 8< ===
> ...
> Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
> PM: Preallocating image memory...
> === >8 ===
> 
> After a short investigation, I found out that this only happens when my
> tmpfs filesystem on /tmp had a lot of data in it. When my tmpfs is empty,
> I have no problems.
> 
> So I wrote a short script which fills up the tmpfs on /tmp and tries to
> hibernate, and I bisected the kernel using this script.
> 
> The end result is that the following commit causes this regression:
> 
> === 8< ===
> commit bb21c7ce18eff8e6e7877ca1d06c6db719376e3c
> Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Date:   Fri Jun 4 14:15:05 2010 -0700
> 
>     vmscan: fix do_try_to_free_pages() return value when priority==0 reclaim failure
> 
>     ...
> === >8 ===
> 
> I have run 2.6.35-rc6, 2.6.35 and 2.6.35.1 with this commit reverted,
> and I am happy to say that I haven't experienced any problems for at
> least 17 days.
> 
> It looks like this change was included with 2.6.35-rc1. I am sorry
> for not testing earlier.
> 
> I am willing to do testing in case anyone would like me to try patches.
> 
> Regards,
> 
> M. Vefa Bicakci

Hmm... 
I've tested hibernation case for a while. but I have no luck. I couldn't
reproduce your issue. Very sorry. Can you please help our debugging? 
If possible, I hope to run following three test.

1. Please let me know your machine & test script

% cat /proc/meminfo
% cat /proc/vmstat
% cat /proc/zoneinfo
% df
% cat your-fills-up-the-tmpfs-script

2. call shrink_all_memory() forcely and show result

% cat /proc/meminfo
% cat /proc/zoneinfo
# echo 1 > /proc/sys/vm/shrink_all_memory
# tail /var/log/messages
% cat /proc/meminfo
% cat /proc/zoneinfo


3. reset zone_reclaim_stat and rerun shrink_all_memory

# echo 1 > /proc/sys/vm/reset_reclaim_stat
% cat /proc/meminfo
% cat /proc/zoneinfo
# echo 1 > /proc/sys/vm/shrink_all_memory
# tail /var/log/messages
% cat /proc/meminfo
% cat /proc/zoneinfo



[-- Attachment #2: 0001-debug-print-sysctl.patch --]
[-- Type: application/octet-stream, Size: 2174 bytes --]

From 57544e31e5ad966a86f7ff9dbe9299877b2fb9c8 Mon Sep 17 00:00:00 2001
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Date: Fri, 20 Aug 2010 11:08:33 +0900
Subject: [PATCH 1/4] debug print + sysctl

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 kernel/sysctl.c |   20 ++++++++++++++++++++
 mm/vmscan.c     |    7 +++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d24f761..e1b22ed 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -961,6 +961,19 @@ static struct ctl_table kern_table[] = {
 	{ }
 };
 
+static int sysctl_shrink_all_memory;
+static int shrink_all_memory_handler(ctl_table *table, int write,
+				     void __user *buffer, size_t *length,
+				     loff_t *ppos)
+{
+	proc_dointvec_minmax(table, write, buffer, length, ppos);
+	if (write) {
+		shrink_all_memory(sysctl_shrink_all_memory);
+	}
+	return 0;
+}
+
+
 static struct ctl_table vm_table[] = {
 	{
 		.procname	= "overcommit_memory",
@@ -1318,6 +1331,13 @@ static struct ctl_table vm_table[] = {
 		.extra2		= &one,
 	},
 #endif
+	{
+		.procname	= "shrink_all_memory",
+		.data		= &sysctl_shrink_all_memory,
+		.maxlen		= sizeof(sysctl_shrink_all_memory),
+		.mode		= 0644,
+		.proc_handler	= shrink_all_memory_handler,
+	},
 
 /*
  * NOTE: do not add new entries to this table unless you have read
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b94fe1b..1ce6c43 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2410,6 +2410,8 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
 	struct task_struct *p = current;
 	unsigned long nr_reclaimed;
 
+	printk(KERN_ERR "shrink_all_memory start\n");
+
 	p->flags |= PF_MEMALLOC;
 	lockdep_set_current_reclaim_state(sc.gfp_mask);
 	reclaim_state.reclaimed_slab = 0;
@@ -2421,6 +2423,11 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
 	lockdep_clear_current_reclaim_state();
 	p->flags &= ~PF_MEMALLOC;
 
+	printk(KERN_ERR "shrink_all_memory: req:%ld reclaimed:%ld free:%ld\n",
+	       nr_to_reclaim,
+		nr_reclaimed,
+	       global_page_state(NR_FREE_PAGES));
+
 	return nr_reclaimed;
 }
 #endif /* CONFIG_HIBERNATION */
-- 
1.6.5.2


[-- Attachment #3: 0003-debug-reset_reclaim_stat.patch --]
[-- Type: application/octet-stream, Size: 1654 bytes --]

From 9b5776352f8d46e3ada80f91f9d978870105630f Mon Sep 17 00:00:00 2001
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Date: Fri, 20 Aug 2010 15:28:22 +0900
Subject: [PATCH 3/4] debug: reset_reclaim_stat

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 kernel/sysctl.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e1b22ed..3b72836 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -973,6 +973,30 @@ static int shrink_all_memory_handler(ctl_table *table, int write,
 	return 0;
 }
 
+#include <linux/mm_types.h>
+#include <linux/mmzone.h>
+
+static int reset_reclaim_stat_handler(ctl_table *table, int write,
+				      void __user *buffer, size_t *length,
+				      loff_t *ppos)
+{
+	struct zone *zone;
+	struct zone_reclaim_stat *rstat;
+
+	if (write) {
+		for_each_populated_zone(zone) {
+			spin_lock_irq(&zone->lru_lock);
+			rstat = &zone->reclaim_stat;
+			rstat->recent_scanned[0] = 0;
+			rstat->recent_rotated[0] = 0;
+			rstat->recent_scanned[1] = 0;
+			rstat->recent_rotated[1] = 0;
+			spin_unlock_irq(&zone->lru_lock);
+		}
+
+	}
+	return 0;
+}
 
 static struct ctl_table vm_table[] = {
 	{
@@ -1338,6 +1362,13 @@ static struct ctl_table vm_table[] = {
 		.mode		= 0644,
 		.proc_handler	= shrink_all_memory_handler,
 	},
+	{
+		.procname	= "reset_reclaim_stat",
+		.data		= &sysctl_shrink_all_memory,
+		.maxlen		= sizeof(sysctl_shrink_all_memory),
+		.mode		= 0644,
+		.proc_handler	= reset_reclaim_stat_handler,
+	},
 
 /*
  * NOTE: do not add new entries to this table unless you have read
-- 
1.6.5.2


[-- Attachment #4: 0004-debug-zone_info-reclaim_stat.patch --]
[-- Type: application/octet-stream, Size: 1575 bytes --]

From 87ce7b4a24f3b381a204ebd654050ac2c6bc2d14 Mon Sep 17 00:00:00 2001
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Date: Fri, 20 Aug 2010 15:52:47 +0900
Subject: [PATCH 4/4] debug: zone_info reclaim_stat

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 mm/vmstat.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 7759941..bee3ba3 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -860,6 +860,33 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
 		   zone->prev_priority,
 		   zone->zone_start_pfn,
 		   zone->inactive_ratio);
+
+	{
+		extern int vm_swappiness;
+		int anon_prio = vm_swappiness;
+		int file_prio = 200 - vm_swappiness;
+		unsigned long ap;
+		unsigned long fp;
+		struct zone_reclaim_stat *reclaim_stat = &zone->reclaim_stat;
+
+		ap = (anon_prio + 1) * (reclaim_stat->recent_scanned[0] + 1);
+		ap /= reclaim_stat->recent_rotated[0] + 1;
+		fp = (file_prio + 1) * (reclaim_stat->recent_scanned[1] + 1);
+		fp /= reclaim_stat->recent_rotated[1] + 1;
+
+		seq_printf(m,
+			   "\n recent_anon_rotated: %lu"
+			   "\n recent_anon_scanned: %lu"
+			   "\n recent_file_rotated: %lu"
+			   "\n recent_file_scanned: %lu"
+			   "\n anon_ratio:          %lu"
+			   ,
+			   zone->reclaim_stat.recent_rotated[0],
+			   zone->reclaim_stat.recent_scanned[0],
+			   zone->reclaim_stat.recent_rotated[1],
+			   zone->reclaim_stat.recent_scanned[1],
+			   (ap * 100) / (ap + fp +1));
+	}
 	seq_putc(m, '\n');
 }
 
-- 
1.6.5.2


  parent reply	other threads:[~2010-08-22 11:06 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-15  5:25 M. Vefa Bicakci
2010-08-17  2:37 ` KOSAKI Motohiro
2010-08-22 11:06 ` KOSAKI Motohiro [this message]
2010-08-22 16:28   ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernation to hang M. Vefa Bicakci
2010-08-25  8:55     ` KOSAKI Motohiro
2010-08-25 10:11       ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernationto hang M. Vefa Bicakci
2010-08-25 17:31       ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernation to hang Rafael J. Wysocki
2010-08-23  0:22   ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causes hibernationto hang KOSAKI Motohiro
2010-08-23  6:27     ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernation to hang M. Vefa Bicakci
2010-08-25  0:48       ` KOSAKI Motohiro
2010-08-25  8:39         ` KOSAKI Motohiro
2010-08-25 10:10           ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernationto hang M. Vefa Bicakci
     [not found]           ` <4C74EB70.3080406@superonline.com>
     [not found]             ` <20100826134506.F676.A69D9226@jp.fujitsu.com>
2010-08-26 10:36               ` M. Vefa Bicakci
2010-08-30  2:28                 ` KOSAKI Motohiro
2010-08-30 16:54                   ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernation to hang M. Vefa Bicakci
2010-08-31  6:35                     ` KOSAKI Motohiro
2010-08-31  6:54                       ` KOSAKI Motohiro
2010-08-31 11:25                         ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernationto hang M. Vefa Bicakci
2010-09-01  0:48                     ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernation to hang KOSAKI Motohiro
2010-09-01 22:02                       ` Rafael J. Wysocki
2010-09-02  0:31                         ` KOSAKI Motohiro
2010-09-02 19:57                           ` Rafael J. Wysocki
2010-09-02 20:24                             ` Rafael J. Wysocki
2010-09-03  0:13                               ` KOSAKI Motohiro
2010-09-03  1:07                                 ` Rafael J. Wysocki
2010-09-03  1:53                                   ` KOSAKI Motohiro
2010-09-04  1:44                                     ` Rafael J. Wysocki
2010-09-06  2:08                                       ` KOSAKI Motohiro
2010-09-06 11:27                                         ` Important news regarding the two different patches M. Vefa Bicakci
2010-09-06 18:43                                           ` Rafael J. Wysocki
2010-09-07  1:34                                             ` M. Vefa Bicakci
2010-09-07  1:58                                               ` KOSAKI Motohiro
2010-09-07 21:44                                                 ` Rafael J. Wysocki
2010-09-08 12:56                                                   ` M. Vefa Bicakci
2010-09-08 21:34                                                     ` [PATCH] PM / Hibernate: Avoid hitting OOM during preallocation of memory (was: Re: Important news ...) Rafael J. Wysocki
2010-09-11 18:12                                                       ` PATCH: PM / Hibernate: Avoid hitting OOM during preallocationof memory M. Vefa Bicakci
2010-09-11 19:06                                                         ` Rafael J. Wysocki
2010-09-11 22:27                                                           ` [PATCH] PM / Hibernate: Make default image size depend on total RAM size (was: Re: PATCH: PM / Hibernate: Avoid hitting OOM ...) Rafael J. Wysocki
2010-09-13 15:40                                                             ` [PATCH] PM / Hibernate: Make default image size depend on totalRAM size M. Vefa Bicakci
2010-09-13 17:52                                                               ` Rafael J. Wysocki
2010-09-06 18:46                                         ` [Bisected Regression in 2.6.35] A full tmpfs filesystem causeshibernation to hang Rafael J. Wysocki
2010-09-06 19:54                                           ` Rafael J. Wysocki

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=20100820115449.5FF1.A69D9226@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=bicave@superonline.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®