All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russ Anderson <rja@sgi.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v6
Date: Mon, 09 Jun 2008 21:03:44 +0000	[thread overview]
Message-ID: <20080609210344.GA9039@sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0806091123400.30605@schroedinger.engr.sgi.com>

On Mon, Jun 09, 2008 at 11:28:00AM -0700, Christoph Lameter wrote:
> On Mon, 9 Jun 2008, Russ Anderson wrote:
> 
> > -#define PAGE_FLAGS	(1 << PG_lru   | 1 << PG_private   | 1 << PG_locked | \
> > +#define PAGE_FLAGS_BASE	(1 << PG_lru   | 1 << PG_private   | 1 << PG_locked | \
> >  			 1 << PG_buddy | 1 << PG_writeback | \
> >  			 1 << PG_slab  | 1 << PG_swapcache | 1 << PG_active)
> > +
> > +#ifdef CONFIG_PAGEFLAGS_EXTENDED
> > +PAGEFLAG(MemError, memerror)
> > +#define	PAGE_FLAGS	(PAGE_FLAGS_BASE | 1UL << PG_memerror)
> > +#else
> > +PAGEFLAG_FALSE(MemError)
> > +#define	PAGE_FLAGS	(PAGE_FLAGS_BASE)
> > +#endif
> 
> Hmmmm... That doesnt look nice. It would be good if we had some definition 
> that  allows the simple oring with a flag mask. That mask should be 
> zero if the flag is always false.
> 
> #ifdef CONFIG_PAGEFLAGS_EXTENDED
> PAGEFLAG(MemError, memerror)
> #define MemError_mask (1 << PG_memerror)
> #else
> PAGEFLAG_FALSE(MemError)
> #define MemError_mask 0
> #endif
> 
> #define	PAGE_FLAGS	(PAGE_FLAGS_BASE | MemError_mask)
> 
> Maybe we could have the PAGEFLAG and the PAGEFLAG_FALSE macros generate 
> these definitions?

Does this look better?


Index: linus/include/linux/page-flags.h
=================================--- linus.orig/include/linux/page-flags.h	2008-06-09 13:48:10.072171477 -0500
+++ linus/include/linux/page-flags.h	2008-06-09 15:58:27.957729371 -0500
@@ -84,6 +84,7 @@ enum pageflags {
 	PG_private,		/* If pagecache, has fs-private data */
 	PG_writeback,		/* Page is under writeback */
 #ifdef CONFIG_PAGEFLAGS_EXTENDED
+	PG_memerror,		/* Page has a physical memory error */
 	PG_head,		/* A head page */
 	PG_tail,		/* A tail page */
 #else
@@ -132,15 +133,21 @@ static inline int TestSetPage##uname(str
 static inline int TestClearPage##uname(struct page *page)		\
 		{ return test_and_clear_bit(PG_##lname, &page->flags); }
 
+#define PAGEFLAGMASK(uname, lname)					\
+static inline int PAGEMASK_##uname(void)				\
+		{ return (1 << PG_##lname); }
 
 #define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname)		\
-	SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
+	SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)		\
+	PAGEFLAGMASK(uname, lname)
 
 #define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname)		\
 	__SETPAGEFLAG(uname, lname)  __CLEARPAGEFLAG(uname, lname)
 
 #define PAGEFLAG_FALSE(uname) 						\
 static inline int Page##uname(struct page *page) 			\
+			{ return 0; }					\
+static inline int PAGEMASK_##uname(void)				\
 			{ return 0; }
 
 #define TESTSCFLAG(uname, lname)					\
@@ -307,9 +314,16 @@ static inline void __ClearPageTail(struc
 
 #endif /* !PAGEFLAGS_EXTENDED */
 
+#ifdef CONFIG_PAGEFLAGS_EXTENDED
+PAGEFLAG(MemError, memerror)
+#else
+PAGEFLAG_FALSE(MemError)
+#endif
+
 #define PAGE_FLAGS	(1 << PG_lru   | 1 << PG_private   | 1 << PG_locked | \
 			 1 << PG_buddy | 1 << PG_writeback | \
-			 1 << PG_slab  | 1 << PG_swapcache | 1 << PG_active)
+			 1 << PG_slab  | 1 << PG_swapcache | 1 << PG_active) |\
+			 PAGEMASK_MemError()
 
 /*
  * Flags checked in bad_page().  Pages on the free list should not have

-- 
Russ Anderson, OS RAS/Partitioning Project Lead  
SGI - Silicon Graphics Inc          rja@sgi.com

WARNING: multiple messages have this Message-ID (diff)
From: Russ Anderson <rja@sgi.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v6
Date: Mon, 9 Jun 2008 16:03:44 -0500	[thread overview]
Message-ID: <20080609210344.GA9039@sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0806091123400.30605@schroedinger.engr.sgi.com>

On Mon, Jun 09, 2008 at 11:28:00AM -0700, Christoph Lameter wrote:
> On Mon, 9 Jun 2008, Russ Anderson wrote:
> 
> > -#define PAGE_FLAGS	(1 << PG_lru   | 1 << PG_private   | 1 << PG_locked | \
> > +#define PAGE_FLAGS_BASE	(1 << PG_lru   | 1 << PG_private   | 1 << PG_locked | \
> >  			 1 << PG_buddy | 1 << PG_writeback | \
> >  			 1 << PG_slab  | 1 << PG_swapcache | 1 << PG_active)
> > +
> > +#ifdef CONFIG_PAGEFLAGS_EXTENDED
> > +PAGEFLAG(MemError, memerror)
> > +#define	PAGE_FLAGS	(PAGE_FLAGS_BASE | 1UL << PG_memerror)
> > +#else
> > +PAGEFLAG_FALSE(MemError)
> > +#define	PAGE_FLAGS	(PAGE_FLAGS_BASE)
> > +#endif
> 
> Hmmmm... That doesnt look nice. It would be good if we had some definition 
> that  allows the simple oring with a flag mask. That mask should be 
> zero if the flag is always false.
> 
> #ifdef CONFIG_PAGEFLAGS_EXTENDED
> PAGEFLAG(MemError, memerror)
> #define MemError_mask (1 << PG_memerror)
> #else
> PAGEFLAG_FALSE(MemError)
> #define MemError_mask 0
> #endif
> 
> #define	PAGE_FLAGS	(PAGE_FLAGS_BASE | MemError_mask)
> 
> Maybe we could have the PAGEFLAG and the PAGEFLAG_FALSE macros generate 
> these definitions?

Does this look better?


Index: linus/include/linux/page-flags.h
===================================================================
--- linus.orig/include/linux/page-flags.h	2008-06-09 13:48:10.072171477 -0500
+++ linus/include/linux/page-flags.h	2008-06-09 15:58:27.957729371 -0500
@@ -84,6 +84,7 @@ enum pageflags {
 	PG_private,		/* If pagecache, has fs-private data */
 	PG_writeback,		/* Page is under writeback */
 #ifdef CONFIG_PAGEFLAGS_EXTENDED
+	PG_memerror,		/* Page has a physical memory error */
 	PG_head,		/* A head page */
 	PG_tail,		/* A tail page */
 #else
@@ -132,15 +133,21 @@ static inline int TestSetPage##uname(str
 static inline int TestClearPage##uname(struct page *page)		\
 		{ return test_and_clear_bit(PG_##lname, &page->flags); }
 
+#define PAGEFLAGMASK(uname, lname)					\
+static inline int PAGEMASK_##uname(void)				\
+		{ return (1 << PG_##lname); }
 
 #define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname)		\
-	SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
+	SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)		\
+	PAGEFLAGMASK(uname, lname)
 
 #define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname)		\
 	__SETPAGEFLAG(uname, lname)  __CLEARPAGEFLAG(uname, lname)
 
 #define PAGEFLAG_FALSE(uname) 						\
 static inline int Page##uname(struct page *page) 			\
+			{ return 0; }					\
+static inline int PAGEMASK_##uname(void)				\
 			{ return 0; }
 
 #define TESTSCFLAG(uname, lname)					\
@@ -307,9 +314,16 @@ static inline void __ClearPageTail(struc
 
 #endif /* !PAGEFLAGS_EXTENDED */
 
+#ifdef CONFIG_PAGEFLAGS_EXTENDED
+PAGEFLAG(MemError, memerror)
+#else
+PAGEFLAG_FALSE(MemError)
+#endif
+
 #define PAGE_FLAGS	(1 << PG_lru   | 1 << PG_private   | 1 << PG_locked | \
 			 1 << PG_buddy | 1 << PG_writeback | \
-			 1 << PG_slab  | 1 << PG_swapcache | 1 << PG_active)
+			 1 << PG_slab  | 1 << PG_swapcache | 1 << PG_active) |\
+			 PAGEMASK_MemError()
 
 /*
  * Flags checked in bad_page().  Pages on the free list should not have

-- 
Russ Anderson, OS RAS/Partitioning Project Lead  
SGI - Silicon Graphics Inc          rja@sgi.com

  reply	other threads:[~2008-06-09 21:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02  0:42 [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v2 Russ Anderson
2008-05-02  0:42 ` Russ Anderson
2008-05-02  1:12 ` Christoph Lameter
2008-05-02  1:12   ` Christoph Lameter
2008-05-02  2:33   ` Russ Anderson
2008-05-02  2:33     ` Russ Anderson
2008-05-09 15:10 ` [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v3 Russ Anderson
2008-05-09 15:10   ` Russ Anderson
2008-05-09 20:11   ` Andrew Morton
2008-05-09 20:11     ` Andrew Morton
2008-05-09 21:51     ` Russ Anderson
2008-05-09 21:51       ` Russ Anderson
2008-05-13 23:03 ` [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v4 Russ Anderson
2008-05-13 23:03   ` Russ Anderson
2008-05-16 19:23 ` [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v5 Russ Anderson
2008-05-16 19:23   ` Russ Anderson
2008-05-16 23:13   ` Christoph Lameter
2008-05-16 23:13     ` Christoph Lameter
2008-06-09 15:57     ` Russ Anderson
2008-06-09 15:57       ` Russ Anderson
2008-06-09 16:19 ` [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v6 Russ Anderson
2008-06-09 16:19   ` Russ Anderson
2008-06-09 18:28   ` Christoph Lameter
2008-06-09 18:28     ` Christoph Lameter
2008-06-09 21:03     ` Russ Anderson [this message]
2008-06-09 21:03       ` Russ Anderson
2008-06-09 21:15       ` Christoph Lameter
2008-06-09 21:15         ` Christoph Lameter
2008-06-09 21:58 ` [PATCH 2/3] mm: Avoid putting a bad page back on the LRU v7 Russ Anderson
2008-06-09 21:58   ` Russ Anderson

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=20080609210344.GA9039@sgi.com \
    --to=rja@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.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 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.