Re: [RFC][PATCH 1/3] swsusp: Do not use page flags directly

Nick Piggin
2007-03-13T04:45:12Z

Rafael J. Wysocki wrote:
> Make swsusp stop using SetPageNosave(), SetPageNosaveFree() and friends
> directly.
>
> This way the amount of changes made in the next patch is smaller.
>
> ---
> include/linux/suspend.h | 33 +++++++++++++++++++++++++++++++++
> kernel/power/snapshot.c | 48 +++++++++++++++++++++++++-----------------------
> mm/page_alloc.c | 6 +++---
> 3 files changed, 61 insertions(+), 26 deletions(-)
>
> Index: linux-2.6.21-rc2/include/linux/suspend.h
> ===================================================================
> --- linux-2.6.21-rc2.orig/include/linux/suspend.h 2007-03-02 09:05:53.000000000 +0100
> +++ linux-2.6.21-rc2/include/linux/suspend.h 2007-03-02 09:24:02.000000000 +0100
> @@ -8,6 +8,7 @@
> #include <linux/notifier.h>
> #include <linux/init.h>
> #include <linux/pm.h>
> +#include <linux/mm.h>
>
> /* struct pbe is used for creating lists of pages that should be restored
> * atomically during the resume from disk, because the page frames they have
> @@ -49,6 +50,38 @@ void __save_processor_state(struct saved
> void __restore_processor_state(struct saved_context *ctxt);
> unsigned long get_safe_page(gfp_t gfp_mask);
>
> +/* Page management functions for the software suspend (swsusp) */
> +
> +static inline void swsusp_set_page_forbidden(struct page *page)
> +{
> + SetPageNosave(page);
> +}
> +
> +static inline int swsusp_page_is_forbidden(struct page *page)
> +{
> + return PageNosave(page);
> +}
> +
> +static inline void swsusp_unset_page_forbidden(struct page *page)
> +{
> + ClearPageNosave(page);
> +}
> +
> +static inline void swsusp_set_page_free(struct page *page)
> +{
> + SetPageNosaveFree(page);
> +}
> +
> +static inline int swsusp_page_is_free(struct page *page)
> +{
> + return PageNosaveFree(page);
> +}
> +
> +static inline void swsusp_unset_page_free(struct page *page)
> +{
> + ClearPageNosaveFree(page);
> +}

Hi,

I don't have much to do with swsusp, but I really prefer that a
page flag name should tell you what the property of the page is,
rather than what this subsystem should or shouldn't do with it.

I thought the page flag names I used were pretty nice, and a big
improvement overthe current page flag names.

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com