All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-09  8:43 ` Anisse Astier
  0 siblings, 0 replies; 14+ messages in thread
From: Anisse Astier @ 2016-09-09  8:43 UTC (permalink / raw)
  To: linux-mm, linux-pm
  Cc: Anisse Astier, Kirill A . Shutemov, Laura Abbott, Mel Gorman,
	Rafael J . Wysocki, Alan Cox, Andi Kleen, Andrew Morton,
	Brad Spengler, Dave Hansen, David Rientjes, Jianyu Zhan,
	Kees Cook, Len Brown, Linus Torvalds, Mathias Krause,
	Michal Hocko, PaX Team, Pavel Machek, Peter Zijlstra,
	Vlastimil Babka, Yves-Alexis Perez, linux-kernel

PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
poisoned (zeroed) as they become available.
In the hibernate use case, free pages will appear in the system without
being cleared, left there by the loading kernel.

This patch will make sure free pages are cleared on resume when
PAGE_POISONING_ZERO is enabled. We free the pages just after resume
because we can't do it later: going through any device resume code might
allocate some memory and invalidate the free pages bitmap.

Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
enabled.

Signed-off-by: Anisse Astier <anisse@astier.eu>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
---
 kernel/power/hibernate.c | 21 +++------------------
 kernel/power/power.h     |  2 ++
 kernel/power/snapshot.c  | 22 ++++++++++++++++++++++
 mm/Kconfig.debug         |  2 --
 4 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 33c79b6..b26dbc4 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -306,8 +306,10 @@ static int create_image(int platform_mode)
 	if (error)
 		printk(KERN_ERR "PM: Error %d creating hibernation image\n",
 			error);
-	if (!in_suspend)
+	if (!in_suspend) {
 		events_check_enabled = false;
+		clear_free_pages();
+	}
 
 	platform_leave(platform_mode);
 
@@ -1189,22 +1191,6 @@ static int __init nohibernate_setup(char *str)
 	return 1;
 }
 
-static int __init page_poison_nohibernate_setup(char *str)
-{
-#ifdef CONFIG_PAGE_POISONING_ZERO
-	/*
-	 * The zeroing option for page poison skips the checks on alloc.
-	 * since hibernation doesn't save free pages there's no way to
-	 * guarantee the pages will still be zeroed.
-	 */
-	if (!strcmp(str, "on")) {
-		pr_info("Disabling hibernation due to page poisoning\n");
-		return nohibernate_setup(str);
-	}
-#endif
-	return 1;
-}
-
 __setup("noresume", noresume_setup);
 __setup("resume_offset=", resume_offset_setup);
 __setup("resume=", resume_setup);
@@ -1212,4 +1198,3 @@ __setup("hibernate=", hibernate_setup);
 __setup("resumewait", resumewait_setup);
 __setup("resumedelay=", resumedelay_setup);
 __setup("nohibernate", nohibernate_setup);
-__setup("page_poison=", page_poison_nohibernate_setup);
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 242d8b8..56d1d0d 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -110,6 +110,8 @@ extern int create_basic_memory_bitmaps(void);
 extern void free_basic_memory_bitmaps(void);
 extern int hibernate_preallocate_memory(void);
 
+extern void clear_free_pages(void);
+
 /**
  *	Auxiliary structure used for reading the snapshot image data and
  *	metadata from and writing them to the list of page backup entries
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index b022284..4f0f060 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1132,6 +1132,28 @@ void free_basic_memory_bitmaps(void)
 	pr_debug("PM: Basic memory bitmaps freed\n");
 }
 
+void clear_free_pages(void)
+{
+#ifdef CONFIG_PAGE_POISONING_ZERO
+	struct memory_bitmap *bm = free_pages_map;
+	unsigned long pfn;
+
+	if (WARN_ON(!(free_pages_map)))
+		return;
+
+	memory_bm_position_reset(bm);
+	pfn = memory_bm_next_pfn(bm);
+	while (pfn != BM_END_OF_MAP) {
+		if (pfn_valid(pfn))
+			clear_highpage(pfn_to_page(pfn));
+
+		pfn = memory_bm_next_pfn(bm);
+	}
+	memory_bm_position_reset(bm);
+	pr_info("PM: free pages cleared after restore\n");
+#endif /* PAGE_POISONING_ZERO */
+}
+
 /**
  * snapshot_additional_pages - Estimate the number of extra pages needed.
  * @zone: Memory zone to carry out the computation for.
diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
index 22f4cd9..afcc550 100644
--- a/mm/Kconfig.debug
+++ b/mm/Kconfig.debug
@@ -76,8 +76,6 @@ config PAGE_POISONING_ZERO
 	   no longer necessary to write zeros when GFP_ZERO is used on
 	   allocation.
 
-	   Enabling page poisoning with this option will disable hibernation
-
 	   If unsure, say N
 	bool
 
-- 
2.7.4

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

* [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-09  8:43 ` Anisse Astier
  0 siblings, 0 replies; 14+ messages in thread
From: Anisse Astier @ 2016-09-09  8:43 UTC (permalink / raw)
  To: linux-mm, linux-pm
  Cc: Anisse Astier, Kirill A . Shutemov, Laura Abbott, Mel Gorman,
	Rafael J . Wysocki, Alan Cox, Andi Kleen, Andrew Morton,
	Brad Spengler, Dave Hansen, David Rientjes, Jianyu Zhan,
	Kees Cook, Len Brown, Linus Torvalds, Mathias Krause,
	Michal Hocko, PaX Team, Pavel Machek, Peter Zijlstra,
	Vlastimil Babka, Yves-Alexis Perez, linux-kernel

PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
poisoned (zeroed) as they become available.
In the hibernate use case, free pages will appear in the system without
being cleared, left there by the loading kernel.

This patch will make sure free pages are cleared on resume when
PAGE_POISONING_ZERO is enabled. We free the pages just after resume
because we can't do it later: going through any device resume code might
allocate some memory and invalidate the free pages bitmap.

Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
enabled.

Signed-off-by: Anisse Astier <anisse@astier.eu>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
---
 kernel/power/hibernate.c | 21 +++------------------
 kernel/power/power.h     |  2 ++
 kernel/power/snapshot.c  | 22 ++++++++++++++++++++++
 mm/Kconfig.debug         |  2 --
 4 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 33c79b6..b26dbc4 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -306,8 +306,10 @@ static int create_image(int platform_mode)
 	if (error)
 		printk(KERN_ERR "PM: Error %d creating hibernation image\n",
 			error);
-	if (!in_suspend)
+	if (!in_suspend) {
 		events_check_enabled = false;
+		clear_free_pages();
+	}
 
 	platform_leave(platform_mode);
 
@@ -1189,22 +1191,6 @@ static int __init nohibernate_setup(char *str)
 	return 1;
 }
 
-static int __init page_poison_nohibernate_setup(char *str)
-{
-#ifdef CONFIG_PAGE_POISONING_ZERO
-	/*
-	 * The zeroing option for page poison skips the checks on alloc.
-	 * since hibernation doesn't save free pages there's no way to
-	 * guarantee the pages will still be zeroed.
-	 */
-	if (!strcmp(str, "on")) {
-		pr_info("Disabling hibernation due to page poisoning\n");
-		return nohibernate_setup(str);
-	}
-#endif
-	return 1;
-}
-
 __setup("noresume", noresume_setup);
 __setup("resume_offset=", resume_offset_setup);
 __setup("resume=", resume_setup);
@@ -1212,4 +1198,3 @@ __setup("hibernate=", hibernate_setup);
 __setup("resumewait", resumewait_setup);
 __setup("resumedelay=", resumedelay_setup);
 __setup("nohibernate", nohibernate_setup);
-__setup("page_poison=", page_poison_nohibernate_setup);
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 242d8b8..56d1d0d 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -110,6 +110,8 @@ extern int create_basic_memory_bitmaps(void);
 extern void free_basic_memory_bitmaps(void);
 extern int hibernate_preallocate_memory(void);
 
+extern void clear_free_pages(void);
+
 /**
  *	Auxiliary structure used for reading the snapshot image data and
  *	metadata from and writing them to the list of page backup entries
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index b022284..4f0f060 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1132,6 +1132,28 @@ void free_basic_memory_bitmaps(void)
 	pr_debug("PM: Basic memory bitmaps freed\n");
 }
 
+void clear_free_pages(void)
+{
+#ifdef CONFIG_PAGE_POISONING_ZERO
+	struct memory_bitmap *bm = free_pages_map;
+	unsigned long pfn;
+
+	if (WARN_ON(!(free_pages_map)))
+		return;
+
+	memory_bm_position_reset(bm);
+	pfn = memory_bm_next_pfn(bm);
+	while (pfn != BM_END_OF_MAP) {
+		if (pfn_valid(pfn))
+			clear_highpage(pfn_to_page(pfn));
+
+		pfn = memory_bm_next_pfn(bm);
+	}
+	memory_bm_position_reset(bm);
+	pr_info("PM: free pages cleared after restore\n");
+#endif /* PAGE_POISONING_ZERO */
+}
+
 /**
  * snapshot_additional_pages - Estimate the number of extra pages needed.
  * @zone: Memory zone to carry out the computation for.
diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
index 22f4cd9..afcc550 100644
--- a/mm/Kconfig.debug
+++ b/mm/Kconfig.debug
@@ -76,8 +76,6 @@ config PAGE_POISONING_ZERO
 	   no longer necessary to write zeros when GFP_ZERO is used on
 	   allocation.
 
-	   Enabling page poisoning with this option will disable hibernation
-
 	   If unsure, say N
 	bool
 
-- 
2.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
  2016-09-09  8:43 ` Anisse Astier
  (?)
@ 2016-09-09 18:29   ` Kees Cook
  -1 siblings, 0 replies; 14+ messages in thread
From: Kees Cook @ 2016-09-09 18:29 UTC (permalink / raw)
  To: Anisse Astier, Laura Abbott
  Cc: Linux-MM, Linux PM list, Kirill A . Shutemov, Mel Gorman,
	Rafael J . Wysocki, Alan Cox, Andi Kleen, Andrew Morton,
	Brad Spengler, Dave Hansen, David Rientjes, Jianyu Zhan,
	Len Brown, Linus Torvalds, Mathias Krause, Michal Hocko,
	PaX Team, Pavel Machek, Peter Zijlstra, Vlastimil Babka,
	Yves-Alexis Perez, LKML

On Fri, Sep 9, 2016 at 1:43 AM, Anisse Astier <anisse@astier.eu> wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
>
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
>
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
>
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Cool!

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook
Nexus Security

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-09 18:29   ` Kees Cook
  0 siblings, 0 replies; 14+ messages in thread
From: Kees Cook @ 2016-09-09 18:29 UTC (permalink / raw)
  To: Anisse Astier, Laura Abbott
  Cc: Linux-MM, Linux PM list, Kirill A . Shutemov, Mel Gorman,
	Rafael J . Wysocki, Alan Cox, Andi Kleen, Andrew Morton,
	Brad Spengler, Dave Hansen, David Rientjes, Jianyu Zhan,
	Len Brown, Linus Torvalds, Mathias Krause, Michal Hocko,
	PaX Team, Pavel Machek, Peter Zijlstra, Vlastimil Babka

On Fri, Sep 9, 2016 at 1:43 AM, Anisse Astier <anisse@astier.eu> wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
>
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
>
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
>
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Cool!

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook
Nexus Security

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-09 18:29   ` Kees Cook
  0 siblings, 0 replies; 14+ messages in thread
From: Kees Cook @ 2016-09-09 18:29 UTC (permalink / raw)
  To: Anisse Astier, Laura Abbott
  Cc: Linux-MM, Linux PM list, Kirill A . Shutemov, Mel Gorman,
	Rafael J . Wysocki, Alan Cox, Andi Kleen, Andrew Morton,
	Brad Spengler, Dave Hansen, David Rientjes, Jianyu Zhan,
	Len Brown, Linus Torvalds, Mathias Krause, Michal Hocko,
	PaX Team, Pavel Machek, Peter Zijlstra, Vlastimil Babka,
	Yves-Alexis Perez, LKML

On Fri, Sep 9, 2016 at 1:43 AM, Anisse Astier <anisse@astier.eu> wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
>
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
>
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
>
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Cool!

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook
Nexus Security

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
  2016-09-09  8:43 ` Anisse Astier
@ 2016-09-12 11:32   ` Pavel Machek
  -1 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2016-09-12 11:32 UTC (permalink / raw)
  To: Anisse Astier
  Cc: linux-mm, linux-pm, Kirill A . Shutemov, Laura Abbott,
	Mel Gorman, Rafael J . Wysocki, Alan Cox, Andi Kleen,
	Andrew Morton, Brad Spengler, Dave Hansen, David Rientjes,
	Jianyu Zhan, Kees Cook, Len Brown, Linus Torvalds,
	Mathias Krause, Michal Hocko, PaX Team, Peter Zijlstra,
	Vlastimil Babka, Yves-Alexis Perez, linux-kernel

On Fri 2016-09-09 10:43:32, Anisse Astier wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
> 
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
> 
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
> 
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Looks reasonable to me.

Acked-by: Pavel Machek <pavel@ucw.cz>

Actually.... this takes basically zero time come. Do we want to do it
unconditionally?

(Yes, it is free memory, but for sake of debugging, I guess zeros are
preffered to random content that changed during hibernation.)

(But that does not change the Ack.)

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-12 11:32   ` Pavel Machek
  0 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2016-09-12 11:32 UTC (permalink / raw)
  To: Anisse Astier
  Cc: linux-mm, linux-pm, Kirill A . Shutemov, Laura Abbott,
	Mel Gorman, Rafael J . Wysocki, Alan Cox, Andi Kleen,
	Andrew Morton, Brad Spengler, Dave Hansen, David Rientjes,
	Jianyu Zhan, Kees Cook, Len Brown, Linus Torvalds,
	Mathias Krause, Michal Hocko, PaX Team, Peter Zijlstra,
	Vlastimil Babka, Yves-Alexis Perez, linux-kernel

On Fri 2016-09-09 10:43:32, Anisse Astier wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
> 
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
> 
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
> 
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Looks reasonable to me.

Acked-by: Pavel Machek <pavel@ucw.cz>

Actually.... this takes basically zero time come. Do we want to do it
unconditionally?

(Yes, it is free memory, but for sake of debugging, I guess zeros are
preffered to random content that changed during hibernation.)

(But that does not change the Ack.)

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
  2016-09-12 11:32   ` Pavel Machek
  (?)
@ 2016-09-12 15:19   ` Anisse Astier
  2016-09-12 17:47       ` Pavel Machek
  -1 siblings, 1 reply; 14+ messages in thread
From: Anisse Astier @ 2016-09-12 15:19 UTC (permalink / raw)
  To: Pavel Machek
  Cc: David Rientjes, Michal Hocko, linux-pm, Mathias Krause,
	Andrew Morton, Rafael J . Wysocki, Laura Abbott, linux-mm,
	Brad Spengler, Jianyu Zhan, Linus Torvalds, Vlastimil Babka,
	Kirill A . Shutemov, Yves-Alexis Perez, Kees Cook, linux-kernel,
	Andi Kleen, Len Brown, Alan Cox, PaX Team, Dave Hansen,
	Mel Gorman, Peter Zijlstra

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

Le 12 sept. 2016 13:32, "Pavel Machek" <pavel@ucw.cz> a écrit :
>
> On Fri 2016-09-09 10:43:32, Anisse Astier wrote:
> > PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> > poisoned (zeroed) as they become available.
> > In the hibernate use case, free pages will appear in the system without
> > being cleared, left there by the loading kernel.
> >
> > This patch will make sure free pages are cleared on resume when
> > PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> > because we can't do it later: going through any device resume code might
> > allocate some memory and invalidate the free pages bitmap.
> >
> > Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> > enabled.
> >
> > Signed-off-by: Anisse Astier <anisse@astier.eu>
> > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Laura Abbott <labbott@fedoraproject.org>
> > Cc: Mel Gorman <mgorman@suse.de>
> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
>
> Looks reasonable to me.
>
> Acked-by: Pavel Machek <pavel@ucw.cz>
>
> Actually.... this takes basically zero time come. Do we want to do it
> unconditionally?
>
> (Yes, it is free memory, but for sake of debugging, I guess zeros are
> preffered to random content that changed during hibernation.)
>
> (But that does not change the Ack.)
>
> Best regards,
>
Pavel
> --

I have no opposition on doing this unconditionally. I can send a v2 as soon
as I get closer to a computer.

Regards,

Anisse

Sorry for the brevity, I'm posting this on mobile.

[-- Attachment #2: Type: text/html, Size: 2423 bytes --]

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
  2016-09-12 15:19   ` Anisse Astier
  2016-09-12 17:47       ` Pavel Machek
@ 2016-09-12 17:47       ` Pavel Machek
  0 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2016-09-12 17:47 UTC (permalink / raw)
  To: Anisse Astier
  Cc: David Rientjes, Michal Hocko, linux-pm, Mathias Krause,
	Andrew Morton, Rafael J . Wysocki, Laura Abbott, linux-mm,
	Brad Spengler, Jianyu Zhan, Linus Torvalds, Vlastimil Babka,
	Kirill A . Shutemov, Yves-Alexis Perez, Kees Cook, linux-kernel,
	Andi Kleen, Len Brown, Alan Cox, PaX Team, Dave Hansen,
	Mel Gorman, Peter Zijlstra

Hi!

On Mon 2016-09-12 17:19:54, Anisse Astier wrote:
> Le 12 sept. 2016 13:32, "Pavel Machek" <pavel@ucw.cz> a écrit :
> >
> > On Fri 2016-09-09 10:43:32, Anisse Astier wrote:
> > > PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> > > poisoned (zeroed) as they become available.
> > > In the hibernate use case, free pages will appear in the system without
> > > being cleared, left there by the loading kernel.
> > >
> > > This patch will make sure free pages are cleared on resume when
> > > PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> > > because we can't do it later: going through any device resume code might
> > > allocate some memory and invalidate the free pages bitmap.
> > >
> > > Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> > > enabled.
> > >
> > > Signed-off-by: Anisse Astier <anisse@astier.eu>
> > > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Cc: Laura Abbott <labbott@fedoraproject.org>
> > > Cc: Mel Gorman <mgorman@suse.de>
> > > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> >
> > Looks reasonable to me.
> >
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> >
> > Actually.... this takes basically zero time come. Do we want to do it
> > unconditionally?
> >
> > (Yes, it is free memory, but for sake of debugging, I guess zeros are
> > preffered to random content that changed during hibernation.)
> >
> > (But that does not change the Ack.)
> >
> > Best regards,
> >
> Pavel
> > --
> 
> I have no opposition on doing this unconditionally. I can send a v2 as soon
> as I get closer to a computer.

Actually, I'd keep this one as is, when it works and there are no
problems for a release or so, we can delete the ifdefs.

Thanks!
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-12 17:47       ` Pavel Machek
  0 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2016-09-12 17:47 UTC (permalink / raw)
  To: Anisse Astier
  Cc: David Rientjes, Michal Hocko, linux-pm, Mathias Krause,
	Andrew Morton, Rafael J . Wysocki, Laura Abbott, linux-mm,
	Brad Spengler, Jianyu Zhan, Linus Torvalds, Vlastimil Babka,
	Kirill A . Shutemov, Yves-Alexis Perez, Kees Cook, linux-kernel,
	Andi Kleen, Len Brown, Alan Cox, PaX Team, Dave Hansen,
	Mel Gorman, Peter Zijlstra

Hi!

On Mon 2016-09-12 17:19:54, Anisse Astier wrote:
> Le 12 sept. 2016 13:32, "Pavel Machek" <pavel@ucw.cz> a écrit :
> >
> > On Fri 2016-09-09 10:43:32, Anisse Astier wrote:
> > > PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> > > poisoned (zeroed) as they become available.
> > > In the hibernate use case, free pages will appear in the system without
> > > being cleared, left there by the loading kernel.
> > >
> > > This patch will make sure free pages are cleared on resume when
> > > PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> > > because we can't do it later: going through any device resume code might
> > > allocate some memory and invalidate the free pages bitmap.
> > >
> > > Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> > > enabled.
> > >
> > > Signed-off-by: Anisse Astier <anisse@astier.eu>
> > > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Cc: Laura Abbott <labbott@fedoraproject.org>
> > > Cc: Mel Gorman <mgorman@suse.de>
> > > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> >
> > Looks reasonable to me.
> >
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> >
> > Actually.... this takes basically zero time come. Do we want to do it
> > unconditionally?
> >
> > (Yes, it is free memory, but for sake of debugging, I guess zeros are
> > preffered to random content that changed during hibernation.)
> >
> > (But that does not change the Ack.)
> >
> > Best regards,
> >
> Pavel
> > --
> 
> I have no opposition on doing this unconditionally. I can send a v2 as soon
> as I get closer to a computer.

Actually, I'd keep this one as is, when it works and there are no
problems for a release or so, we can delete the ifdefs.

Thanks!
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-12 17:47       ` Pavel Machek
  0 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2016-09-12 17:47 UTC (permalink / raw)
  To: Anisse Astier
  Cc: David Rientjes, Michal Hocko, linux-pm, Mathias Krause,
	Andrew Morton, Rafael J . Wysocki, Laura Abbott, linux-mm,
	Brad Spengler, Jianyu Zhan, Linus Torvalds, Vlastimil Babka,
	Kirill A . Shutemov, Yves-Alexis Perez, Kees Cook, linux-kernel,
	Andi Kleen, Len Brown, Alan Cox, PaX Team, Dave Hansen,
	Mel Gorman, Peter Zijlstra

Hi!

On Mon 2016-09-12 17:19:54, Anisse Astier wrote:
> Le 12 sept. 2016 13:32, "Pavel Machek" <pavel@ucw.cz> a ecrit :
> >
> > On Fri 2016-09-09 10:43:32, Anisse Astier wrote:
> > > PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> > > poisoned (zeroed) as they become available.
> > > In the hibernate use case, free pages will appear in the system without
> > > being cleared, left there by the loading kernel.
> > >
> > > This patch will make sure free pages are cleared on resume when
> > > PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> > > because we can't do it later: going through any device resume code might
> > > allocate some memory and invalidate the free pages bitmap.
> > >
> > > Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> > > enabled.
> > >
> > > Signed-off-by: Anisse Astier <anisse@astier.eu>
> > > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Cc: Laura Abbott <labbott@fedoraproject.org>
> > > Cc: Mel Gorman <mgorman@suse.de>
> > > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> >
> > Looks reasonable to me.
> >
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> >
> > Actually.... this takes basically zero time come. Do we want to do it
> > unconditionally?
> >
> > (Yes, it is free memory, but for sake of debugging, I guess zeros are
> > preffered to random content that changed during hibernation.)
> >
> > (But that does not change the Ack.)
> >
> > Best regards,
> >
> Pavel
> > --
> 
> I have no opposition on doing this unconditionally. I can send a v2 as soon
> as I get closer to a computer.

Actually, I'd keep this one as is, when it works and there are no
problems for a release or so, we can delete the ifdefs.

Thanks!
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
  2016-09-09  8:43 ` Anisse Astier
  (?)
@ 2016-09-14  1:00   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2016-09-14  1:00 UTC (permalink / raw)
  To: Anisse Astier
  Cc: linux-mm, linux-pm, Kirill A . Shutemov, Laura Abbott,
	Mel Gorman, Alan Cox, Andi Kleen, Andrew Morton, Brad Spengler,
	Dave Hansen, David Rientjes, Jianyu Zhan, Kees Cook, Len Brown,
	Linus Torvalds, Mathias Krause, Michal Hocko, PaX Team,
	Pavel Machek, Peter Zijlstra, Vlastimil Babka, Yves-Alexis Perez,
	linux-kernel, Kees Cook, Pavel Machek

On Friday, September 09, 2016 10:43:32 AM Anisse Astier wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
> 
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
> 
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
> 
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Applied (with the tags from Pavel and Kees).

Thanks,
Rafael

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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-14  1:00   ` Rafael J. Wysocki
  0 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2016-09-14  1:00 UTC (permalink / raw)
  To: Anisse Astier
  Cc: linux-mm, linux-pm, Kirill A . Shutemov, Laura Abbott,
	Mel Gorman, Alan Cox, Andi Kleen, Andrew Morton, Brad Spengler,
	Dave Hansen, David Rientjes, Jianyu Zhan, Kees Cook, Len Brown,
	Linus Torvalds, Mathias Krause, Michal Hocko, PaX Team,
	Pavel Machek, Peter Zijlstra, Vlastimil Babka

On Friday, September 09, 2016 10:43:32 AM Anisse Astier wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
> 
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
> 
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
> 
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Applied (with the tags from Pavel and Kees).

Thanks,
Rafael


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

* Re: [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO
@ 2016-09-14  1:00   ` Rafael J. Wysocki
  0 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2016-09-14  1:00 UTC (permalink / raw)
  To: Anisse Astier
  Cc: linux-mm, linux-pm, Kirill A . Shutemov, Laura Abbott,
	Mel Gorman, Alan Cox, Andi Kleen, Andrew Morton, Brad Spengler,
	Dave Hansen, David Rientjes, Jianyu Zhan, Kees Cook, Len Brown,
	Linus Torvalds, Mathias Krause, Michal Hocko, PaX Team,
	Pavel Machek, Peter Zijlstra, Vlastimil Babka, Yves-Alexis Perez,
	linux-kernel

On Friday, September 09, 2016 10:43:32 AM Anisse Astier wrote:
> PAGE_POISONING_ZERO disables zeroing new pages on alloc, they are
> poisoned (zeroed) as they become available.
> In the hibernate use case, free pages will appear in the system without
> being cleared, left there by the loading kernel.
> 
> This patch will make sure free pages are cleared on resume when
> PAGE_POISONING_ZERO is enabled. We free the pages just after resume
> because we can't do it later: going through any device resume code might
> allocate some memory and invalidate the free pages bitmap.
> 
> Thus we don't need to disable hibernation when PAGE_POISONING_ZERO is
> enabled.
> 
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

Applied (with the tags from Pavel and Kees).

Thanks,
Rafael

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-09-14  0:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-09  8:43 [PATCH] PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO Anisse Astier
2016-09-09  8:43 ` Anisse Astier
2016-09-09 18:29 ` Kees Cook
2016-09-09 18:29   ` Kees Cook
2016-09-09 18:29   ` Kees Cook
2016-09-12 11:32 ` Pavel Machek
2016-09-12 11:32   ` Pavel Machek
2016-09-12 15:19   ` Anisse Astier
2016-09-12 17:47     ` Pavel Machek
2016-09-12 17:47       ` Pavel Machek
2016-09-12 17:47       ` Pavel Machek
2016-09-14  1:00 ` Rafael J. Wysocki
2016-09-14  1:00   ` Rafael J. Wysocki
2016-09-14  1:00   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.