* [patch 1/2] own header file for struct page.
@ 2006-09-08 11:17 Heiko Carstens, Heiko Carstens
2006-09-08 16:46 ` Andrew Morton
2006-09-09 21:05 ` [patch 1/2] own header file for struct page Roman Zippel
0 siblings, 2 replies; 12+ messages in thread
From: Heiko Carstens, Heiko Carstens @ 2006-09-08 11:17 UTC (permalink / raw)
To: Andrew Morton, linux-mm, linux-kernel; +Cc: Martin Schwidefsky
This moves the definition of struct page from mm.h to its own header file
page.h.
This is a prereq to fix SetPageUptodate which is broken on s390:
#define SetPageUptodate(_page)
do {
struct page *__page = (_page);
if (!test_and_set_bit(PG_uptodate, &__page->flags))
page_test_and_clear_dirty(_page);
} while (0)
_page gets used twice in this macro which can cause subtle bugs. Using
__page for the page_test_and_clear_dirty call doesn't work since it
causes yet another problem with the page_test_and_clear_dirty macro as
well.
In order to get of all these problems caused by macros it seems to
be a good idea to get rid of them and convert them to static inline
functions. Because of header file include order it's necessary to have a
seperate header file for the struct page definition.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
Patches are against git tree as of today. Better ideas welcome of course.
include/linux/mm.h | 64 --------------------------------------------
include/linux/page.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 63 deletions(-)
Index: linux-2.6/include/linux/mm.h
===================================================================
--- linux-2.6.orig/include/linux/mm.h 2006-09-08 10:46:25.000000000 +0200
+++ linux-2.6/include/linux/mm.h 2006-09-08 12:41:49.000000000 +0200
@@ -15,6 +15,7 @@
#include <linux/fs.h>
#include <linux/mutex.h>
#include <linux/debug_locks.h>
+#include <linux/page.h>
struct mempolicy;
struct anon_vma;
@@ -215,64 +216,6 @@
struct inode;
/*
- * Each physical page in the system has a struct page associated with
- * it to keep track of whatever it is we are using the page for at the
- * moment. Note that we have no way to track which tasks are using
- * a page.
- */
-struct page {
- unsigned long flags; /* Atomic flags, some possibly
- * updated asynchronously */
- atomic_t _count; /* Usage count, see below. */
- atomic_t _mapcount; /* Count of ptes mapped in mms,
- * to show when page is mapped
- * & limit reverse map searches.
- */
- union {
- struct {
- unsigned long private; /* Mapping-private opaque data:
- * usually used for buffer_heads
- * if PagePrivate set; used for
- * swp_entry_t if PageSwapCache;
- * indicates order in the buddy
- * system if PG_buddy is set.
- */
- struct address_space *mapping; /* If low bit clear, points to
- * inode address_space, or NULL.
- * If page mapped as anonymous
- * memory, low bit is set, and
- * it points to anon_vma object:
- * see PAGE_MAPPING_ANON below.
- */
- };
-#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
- spinlock_t ptl;
-#endif
- };
- pgoff_t index; /* Our offset within mapping. */
- struct list_head lru; /* Pageout list, eg. active_list
- * protected by zone->lru_lock !
- */
- /*
- * On machines where all RAM is mapped into kernel address space,
- * we can simply calculate the virtual address. On machines with
- * highmem some memory is mapped into kernel virtual memory
- * dynamically, so we need a place to store that address.
- * Note that this field could be 16 bits on x86 ... ;)
- *
- * Architectures with slow multiplication can define
- * WANT_PAGE_VIRTUAL in asm/page.h
- */
-#if defined(WANT_PAGE_VIRTUAL)
- void *virtual; /* Kernel virtual address (NULL if
- not kmapped, ie. highmem) */
-#endif /* WANT_PAGE_VIRTUAL */
-};
-
-#define page_private(page) ((page)->private)
-#define set_page_private(page, v) ((page)->private = (v))
-
-/*
* FIXME: take this include out, include page-flags.h in
* files which need it (119 of them)
*/
@@ -521,11 +464,6 @@
*/
#include <linux/vmstat.h>
-#ifndef CONFIG_DISCONTIGMEM
-/* The array of struct pages - for discontigmem use pgdat->lmem_map */
-extern struct page *mem_map;
-#endif
-
static __always_inline void *lowmem_page_address(struct page *page)
{
return __va(page_to_pfn(page) << PAGE_SHIFT);
Index: linux-2.6/include/linux/page.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6/include/linux/page.h 2006-09-08 13:10:23.000000000 +0200
@@ -0,0 +1,74 @@
+#ifndef _LINUX_PAGE_H
+#define _LINUX_PAGE_H
+
+#include <linux/types.h>
+#include <linux/threads.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+struct address_space;
+
+/*
+ * Each physical page in the system has a struct page associated with
+ * it to keep track of whatever it is we are using the page for at the
+ * moment. Note that we have no way to track which tasks are using
+ * a page.
+ */
+struct page {
+ unsigned long flags; /* Atomic flags, some possibly
+ * updated asynchronously */
+ atomic_t _count; /* Usage count, see below. */
+ atomic_t _mapcount; /* Count of ptes mapped in mms,
+ * to show when page is mapped
+ * & limit reverse map searches.
+ */
+ union {
+ struct {
+ unsigned long private; /* Mapping-private opaque data:
+ * usually used for buffer_heads
+ * if PagePrivate set; used for
+ * swp_entry_t if PageSwapCache;
+ * indicates order in the buddy
+ * system if PG_buddy is set.
+ */
+ struct address_space *mapping; /* If low bit clear, points to
+ * inode address_space, or NULL.
+ * If page mapped as anonymous
+ * memory, low bit is set, and
+ * it points to anon_vma object:
+ * see PAGE_MAPPING_ANON below.
+ */
+ };
+#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
+ spinlock_t ptl;
+#endif
+ };
+ pgoff_t index; /* Our offset within mapping. */
+ struct list_head lru; /* Pageout list, eg. active_list
+ * protected by zone->lru_lock !
+ */
+ /*
+ * On machines where all RAM is mapped into kernel address space,
+ * we can simply calculate the virtual address. On machines with
+ * highmem some memory is mapped into kernel virtual memory
+ * dynamically, so we need a place to store that address.
+ * Note that this field could be 16 bits on x86 ... ;)
+ *
+ * Architectures with slow multiplication can define
+ * WANT_PAGE_VIRTUAL in asm/page.h
+ */
+#if defined(WANT_PAGE_VIRTUAL)
+ void *virtual; /* Kernel virtual address (NULL if
+ not kmapped, ie. highmem) */
+#endif /* WANT_PAGE_VIRTUAL */
+};
+
+#define page_private(page) ((page)->private)
+#define set_page_private(page, v) ((page)->private = (v))
+
+#ifndef CONFIG_DISCONTIGMEM
+/* The array of struct pages - for discontigmem use pgdat->lmem_map */
+extern struct page *mem_map;
+#endif
+
+#endif /*_LINUX_PAGE_H */
--
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] 12+ messages in thread
* Re: [patch 1/2] own header file for struct page.
2006-09-08 11:17 [patch 1/2] own header file for struct page Heiko Carstens, Heiko Carstens
@ 2006-09-08 16:46 ` Andrew Morton
2006-09-08 18:33 ` Heiko Carstens
2006-09-09 21:05 ` [patch 1/2] own header file for struct page Roman Zippel
1 sibling, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2006-09-08 16:46 UTC (permalink / raw)
To: Heiko Carstens; +Cc: linux-mm, linux-kernel, Martin Schwidefsky
On Fri, 8 Sep 2006 13:17:16 +0200
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> This moves the definition of struct page from mm.h to its own header file
> page.h.
> This is a prereq to fix SetPageUptodate which is broken on s390:
>
> #define SetPageUptodate(_page)
> do {
> struct page *__page = (_page);
> if (!test_and_set_bit(PG_uptodate, &__page->flags))
> page_test_and_clear_dirty(_page);
> } while (0)
>
> _page gets used twice in this macro which can cause subtle bugs. Using
> __page for the page_test_and_clear_dirty call doesn't work since it
> causes yet another problem with the page_test_and_clear_dirty macro as
> well.
> In order to get of all these problems caused by macros it seems to
> be a good idea to get rid of them and convert them to static inline
> functions. Because of header file include order it's necessary to have a
> seperate header file for the struct page definition.
>
hmm.
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6/include/linux/page.h 2006-09-08 13:10:23.000000000 +0200
We have asm/page.h, and one would expect that a <linux/page.h> would be
related to <asm/page.h> in the usual fashion. But it isn't.
Can we think of a different filename? page-struct.h, maybe? pageframe.h?
> +#ifndef CONFIG_DISCONTIGMEM
> +/* The array of struct pages - for discontigmem use pgdat->lmem_map */
> +extern struct page *mem_map;
> +#endif
Am surprised to see this declaration in this file.
--
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] 12+ messages in thread
* Re: [patch 1/2] own header file for struct page.
2006-09-08 16:46 ` Andrew Morton
@ 2006-09-08 18:33 ` Heiko Carstens
2006-09-08 19:06 ` Andrew Morton
0 siblings, 1 reply; 12+ messages in thread
From: Heiko Carstens @ 2006-09-08 18:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, linux-kernel, Martin Schwidefsky
> > This moves the definition of struct page from mm.h to its own header file
> > page.h.
> > This is a prereq to fix SetPageUptodate which is broken on s390:
> >
> > #define SetPageUptodate(_page)
> > do {
> > struct page *__page = (_page);
> > if (!test_and_set_bit(PG_uptodate, &__page->flags))
> > page_test_and_clear_dirty(_page);
> > } while (0)
> >
> > _page gets used twice in this macro which can cause subtle bugs. Using
> > __page for the page_test_and_clear_dirty call doesn't work since it
> > causes yet another problem with the page_test_and_clear_dirty macro as
> > well.
> > In order to get of all these problems caused by macros it seems to
> > be a good idea to get rid of them and convert them to static inline
> > functions. Because of header file include order it's necessary to have a
> > seperate header file for the struct page definition.
> >
>
> hmm.
>
> > --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> > +++ linux-2.6/include/linux/page.h 2006-09-08 13:10:23.000000000 +0200
>
> We have asm/page.h, and one would expect that a <linux/page.h> would be
> related to <asm/page.h> in the usual fashion. But it isn't.
>
> Can we think of a different filename? page-struct.h, maybe? pageframe.h?
Yes, of course.
> > +#ifndef CONFIG_DISCONTIGMEM
> > +/* The array of struct pages - for discontigmem use pgdat->lmem_map */
> > +extern struct page *mem_map;
> > +#endif
>
> Am surprised to see this declaration in this file.
Hmm... first I thought I could add the same declaration to asm-s390/pgtable.h.
But then deciced against it, since I would just duplicate code.
Any better idea where to put it?
--
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] 12+ messages in thread
* Re: [patch 1/2] own header file for struct page.
2006-09-08 18:33 ` Heiko Carstens
@ 2006-09-08 19:06 ` Andrew Morton
2006-09-08 19:47 ` [patch 1/2] own header file for struct page v2 Heiko Carstens, Heiko Carstens
2006-09-08 19:48 ` [patch 2/2] convert s390 page handling macros to functions v2 Heiko Carstens, Heiko Carstens
0 siblings, 2 replies; 12+ messages in thread
From: Andrew Morton @ 2006-09-08 19:06 UTC (permalink / raw)
To: Heiko Carstens; +Cc: linux-mm, linux-kernel, Martin Schwidefsky
On Fri, 8 Sep 2006 20:33:40 +0200
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> > > +#ifndef CONFIG_DISCONTIGMEM
> > > +/* The array of struct pages - for discontigmem use pgdat->lmem_map */
> > > +extern struct page *mem_map;
> > > +#endif
> >
> > Am surprised to see this declaration in this file.
>
> Hmm... first I thought I could add the same declaration to asm-s390/pgtable.h.
> But then deciced against it, since I would just duplicate code.
> Any better idea where to put it?
dunno. mmzone.h?
--
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] 12+ messages in thread
* [patch 1/2] own header file for struct page v2.
2006-09-08 19:06 ` Andrew Morton
@ 2006-09-08 19:47 ` Heiko Carstens, Heiko Carstens
2006-09-08 19:48 ` [patch 2/2] convert s390 page handling macros to functions v2 Heiko Carstens, Heiko Carstens
1 sibling, 0 replies; 12+ messages in thread
From: Heiko Carstens, Heiko Carstens @ 2006-09-08 19:47 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, linux-kernel, Martin Schwidefsky
This moves the definition of struct page from mm.h to its own header file
page-struct.h.
This is a prereq to fix SetPageUptodate which is broken on s390:
#define SetPageUptodate(_page)
do {
struct page *__page = (_page);
if (!test_and_set_bit(PG_uptodate, &__page->flags))
page_test_and_clear_dirty(_page);
} while (0)
_page gets used twice in this macro which can cause subtle bugs. Using
__page for the page_test_and_clear_dirty call doesn't work since it
causes yet another problem with the page_test_and_clear_dirty macro as
well.
In order to avoid all these problems caused by macros it seems to
be a good idea to get rid of them and convert them to static inline
functions. Because of header file include order it's necessary to have a
seperate header file for the struct page definition.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
Updated patch: - against -mm
- changed name to page-struct.h instead of page.h
- moved mem_map declaration to mmzone.h
include/linux/mm.h | 70 -----------------------------------------
include/linux/mmzone.h | 5 ++
include/linux/page-struct.h | 75 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 81 insertions(+), 69 deletions(-)
Index: linux-2.6.17/include/linux/mm.h
===================================================================
--- linux-2.6.17.orig/include/linux/mm.h 2006-09-08 21:37:06.000000000 +0200
+++ linux-2.6.17/include/linux/mm.h 2006-09-08 21:37:10.000000000 +0200
@@ -16,6 +16,7 @@
#include <linux/mutex.h>
#include <linux/debug_locks.h>
#include <linux/backing-dev.h>
+#include <linux/page-struct.h>
struct mempolicy;
struct anon_vma;
@@ -216,70 +217,6 @@
struct inode;
/*
- * Each physical page in the system has a struct page associated with
- * it to keep track of whatever it is we are using the page for at the
- * moment. Note that we have no way to track which tasks are using
- * a page, though if it is a pagecache page, rmap structures can tell us
- * who is mapping it.
- */
-struct page {
- unsigned long flags; /* Atomic flags, some possibly
- * updated asynchronously */
- atomic_t _count; /* Usage count, see below. */
- atomic_t _mapcount; /* Count of ptes mapped in mms,
- * to show when page is mapped
- * & limit reverse map searches.
- */
- union {
- struct {
- unsigned long private; /* Mapping-private opaque data:
- * usually used for buffer_heads
- * if PagePrivate set; used for
- * swp_entry_t if PageSwapCache;
- * indicates order in the buddy
- * system if PG_buddy is set.
- */
- struct address_space *mapping; /* If low bit clear, points to
- * inode address_space, or NULL.
- * If page mapped as anonymous
- * memory, low bit is set, and
- * it points to anon_vma object:
- * see PAGE_MAPPING_ANON below.
- */
- };
-#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
- spinlock_t ptl;
-#endif
- };
- pgoff_t index; /* Our offset within mapping. */
- struct list_head lru; /* Pageout list, eg. active_list
- * protected by zone->lru_lock !
- */
- /*
- * On machines where all RAM is mapped into kernel address space,
- * we can simply calculate the virtual address. On machines with
- * highmem some memory is mapped into kernel virtual memory
- * dynamically, so we need a place to store that address.
- * Note that this field could be 16 bits on x86 ... ;)
- *
- * Architectures with slow multiplication can define
- * WANT_PAGE_VIRTUAL in asm/page.h
- */
-#if defined(WANT_PAGE_VIRTUAL)
- void *virtual; /* Kernel virtual address (NULL if
- not kmapped, ie. highmem) */
-#endif /* WANT_PAGE_VIRTUAL */
-#ifdef CONFIG_PAGE_OWNER
- int order;
- unsigned int gfp_mask;
- unsigned long trace[8];
-#endif
-};
-
-#define page_private(page) ((page)->private)
-#define set_page_private(page, v) ((page)->private = (v))
-
-/*
* FIXME: take this include out, include page-flags.h in
* files which need it (119 of them)
*/
@@ -551,11 +488,6 @@
*/
#include <linux/vmstat.h>
-#ifndef CONFIG_DISCONTIGMEM
-/* The array of struct pages - for discontigmem use pgdat->lmem_map */
-extern struct page *mem_map;
-#endif
-
static __always_inline void *lowmem_page_address(struct page *page)
{
return __va(page_to_pfn(page) << PAGE_SHIFT);
Index: linux-2.6.17/include/linux/page-struct.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.17/include/linux/page-struct.h 2006-09-08 21:37:10.000000000 +0200
@@ -0,0 +1,75 @@
+#ifndef _LINUX_PAGE_STRUCT_H
+#define _LINUX_PAGE_STRUCT_H
+
+#include <linux/types.h>
+#include <linux/threads.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+struct address_space;
+
+/*
+ * Each physical page in the system has a struct page associated with
+ * it to keep track of whatever it is we are using the page for at the
+ * moment. Note that we have no way to track which tasks are using
+ * a page, though if it is a pagecache page, rmap structures can tell us
+ * who is mapping it.
+ */
+struct page {
+ unsigned long flags; /* Atomic flags, some possibly
+ * updated asynchronously */
+ atomic_t _count; /* Usage count, see below. */
+ atomic_t _mapcount; /* Count of ptes mapped in mms,
+ * to show when page is mapped
+ * & limit reverse map searches.
+ */
+ union {
+ struct {
+ unsigned long private; /* Mapping-private opaque data:
+ * usually used for buffer_heads
+ * if PagePrivate set; used for
+ * swp_entry_t if PageSwapCache;
+ * indicates order in the buddy
+ * system if PG_buddy is set.
+ */
+ struct address_space *mapping; /* If low bit clear, points to
+ * inode address_space, or NULL.
+ * If page mapped as anonymous
+ * memory, low bit is set, and
+ * it points to anon_vma object:
+ * see PAGE_MAPPING_ANON below.
+ */
+ };
+#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
+ spinlock_t ptl;
+#endif
+ };
+ pgoff_t index; /* Our offset within mapping. */
+ struct list_head lru; /* Pageout list, eg. active_list
+ * protected by zone->lru_lock !
+ */
+ /*
+ * On machines where all RAM is mapped into kernel address space,
+ * we can simply calculate the virtual address. On machines with
+ * highmem some memory is mapped into kernel virtual memory
+ * dynamically, so we need a place to store that address.
+ * Note that this field could be 16 bits on x86 ... ;)
+ *
+ * Architectures with slow multiplication can define
+ * WANT_PAGE_VIRTUAL in asm/page.h
+ */
+#if defined(WANT_PAGE_VIRTUAL)
+ void *virtual; /* Kernel virtual address (NULL if
+ not kmapped, ie. highmem) */
+#endif /* WANT_PAGE_VIRTUAL */
+#ifdef CONFIG_PAGE_OWNER
+ int order;
+ unsigned int gfp_mask;
+ unsigned long trace[8];
+#endif
+};
+
+#define page_private(page) ((page)->private)
+#define set_page_private(page, v) ((page)->private = (v))
+
+#endif /* _LINUX_PAGE_STRUCT_H */
Index: linux-2.6.17/include/linux/mmzone.h
===================================================================
--- linux-2.6.17.orig/include/linux/mmzone.h 2006-09-08 21:37:06.000000000 +0200
+++ linux-2.6.17/include/linux/mmzone.h 2006-09-08 21:37:10.000000000 +0200
@@ -318,6 +318,11 @@
};
#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+#ifndef CONFIG_DISCONTIGMEM
+/* The array of struct pages - for discontigmem use pgdat->lmem_map */
+extern struct page *mem_map;
+#endif
+
/*
* The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
* (mostly NUMA machines?) to denote a higher-level memory zone than the
--
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] 12+ messages in thread
* [patch 2/2] convert s390 page handling macros to functions v2
2006-09-08 19:06 ` Andrew Morton
2006-09-08 19:47 ` [patch 1/2] own header file for struct page v2 Heiko Carstens, Heiko Carstens
@ 2006-09-08 19:48 ` Heiko Carstens, Heiko Carstens
1 sibling, 0 replies; 12+ messages in thread
From: Heiko Carstens, Heiko Carstens @ 2006-09-08 19:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, linux-kernel, Martin Schwidefsky
Convert s390 page handling macros to functions. In particular this fixes a
problem with s390's SetPageUptodate macro which uses its input parameter
twice which again can cause subtle bugs.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
include/asm-s390/pgtable.h | 85 +++++++++++++++++++++------------------------
include/linux/page-flags.h | 11 ++---
2 files changed, 46 insertions(+), 50 deletions(-)
Index: linux-2.6.17/include/linux/page-flags.h
===================================================================
--- linux-2.6.17.orig/include/linux/page-flags.h 2006-09-08 21:36:56.000000000 +0200
+++ linux-2.6.17/include/linux/page-flags.h 2006-09-08 21:39:50.000000000 +0200
@@ -130,12 +130,11 @@
#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags)
#ifdef CONFIG_S390
-#define SetPageUptodate(_page) \
- do { \
- struct page *__page = (_page); \
- if (!test_and_set_bit(PG_uptodate, &__page->flags)) \
- page_test_and_clear_dirty(_page); \
- } while (0)
+static inline void SetPageUptodate(struct page *page)
+{
+ if (!test_and_set_bit(PG_uptodate, &page->flags))
+ page_test_and_clear_dirty(page);
+}
#else
#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
#endif
Index: linux-2.6.17/include/asm-s390/pgtable.h
===================================================================
--- linux-2.6.17.orig/include/asm-s390/pgtable.h 2006-09-08 21:36:56.000000000 +0200
+++ linux-2.6.17/include/asm-s390/pgtable.h 2006-09-08 21:39:50.000000000 +0200
@@ -33,7 +33,7 @@
#ifndef __ASSEMBLY__
#include <asm/bug.h>
#include <asm/processor.h>
-#include <linux/threads.h>
+#include <linux/page-struct.h>
struct vm_area_struct; /* forward declaration (include/linux/mm.h) */
struct mm_struct;
@@ -604,30 +604,31 @@
* should therefore only be called if it is not mapped in any
* address space.
*/
-#define page_test_and_clear_dirty(_page) \
-({ \
- struct page *__page = (_page); \
- unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \
- int __skey = page_get_storage_key(__physpage); \
- if (__skey & _PAGE_CHANGED) \
- page_set_storage_key(__physpage, __skey & ~_PAGE_CHANGED);\
- (__skey & _PAGE_CHANGED); \
-})
+static inline int page_test_and_clear_dirty(struct page *page)
+{
+ unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+ int skey = page_get_storage_key(physpage);
+
+ if (skey & _PAGE_CHANGED)
+ page_set_storage_key(physpage, skey & ~_PAGE_CHANGED);
+ return skey & _PAGE_CHANGED;
+}
/*
* Test and clear referenced bit in storage key.
*/
-#define page_test_and_clear_young(page) \
-({ \
- struct page *__page = (page); \
- unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \
- int __ccode; \
- asm volatile ("rrbe 0,%1\n\t" \
- "ipm %0\n\t" \
- "srl %0,28\n\t" \
- : "=d" (__ccode) : "a" (__physpage) : "cc" ); \
- (__ccode & 2); \
-})
+static inline int page_test_and_clear_young(struct page *page)
+{
+ unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+ int ccode;
+
+ asm volatile (
+ "rrbe 0,%1\n"
+ "ipm %0\n"
+ "srl %0,28\n"
+ : "=d" (ccode) : "a" (physpage) : "cc" );
+ return ccode & 2;
+}
/*
* Conversion functions: convert a page and protection to a page entry,
@@ -640,32 +641,28 @@
return __pte;
}
-#define mk_pte(pg, pgprot) \
-({ \
- struct page *__page = (pg); \
- pgprot_t __pgprot = (pgprot); \
- unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \
- pte_t __pte = mk_pte_phys(__physpage, __pgprot); \
- __pte; \
-})
-
-#define pfn_pte(pfn, pgprot) \
-({ \
- pgprot_t __pgprot = (pgprot); \
- unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \
- pte_t __pte = mk_pte_phys(__physpage, __pgprot); \
- __pte; \
-})
+static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
+{
+ unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+
+ return mk_pte_phys(physpage, pgprot);
+}
+
+static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
+{
+ unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
+
+ return mk_pte_phys(physpage, pgprot);
+}
#ifdef __s390x__
-#define pfn_pmd(pfn, pgprot) \
-({ \
- pgprot_t __pgprot = (pgprot); \
- unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \
- pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot)); \
- __pmd; \
-})
+static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
+{
+ unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
+
+ return __pmd(physpage + pgprot_val(pgprot));
+}
#endif /* __s390x__ */
--
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] 12+ messages in thread
* Re: [patch 1/2] own header file for struct page.
2006-09-08 11:17 [patch 1/2] own header file for struct page Heiko Carstens, Heiko Carstens
2006-09-08 16:46 ` Andrew Morton
@ 2006-09-09 21:05 ` Roman Zippel
2006-09-10 7:51 ` Heiko Carstens
` (2 more replies)
1 sibling, 3 replies; 12+ messages in thread
From: Roman Zippel @ 2006-09-09 21:05 UTC (permalink / raw)
To: Heiko Carstens; +Cc: Andrew Morton, linux-mm, linux-kernel, Martin Schwidefsky
Hi,
On Fri, 8 Sep 2006, Heiko Carstens wrote:
> In order to get of all these problems caused by macros it seems to
> be a good idea to get rid of them and convert them to static inline
> functions. Because of header file include order it's necessary to have a
> seperate header file for the struct page definition.
>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
>
> Patches are against git tree as of today. Better ideas welcome of course.
>
> include/linux/mm.h | 64 --------------------------------------------
> include/linux/page.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 75 insertions(+), 63 deletions(-)
To avoid the explosion in number of small header files each containing a
single definition, it would be better to generally split between the
definitions and implementations, so IMO mm_types.h with all the structures
and defines from mm.h would be better.
bye, Roman
--
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] 12+ messages in thread
* Re: [patch 1/2] own header file for struct page.
2006-09-09 21:05 ` [patch 1/2] own header file for struct page Roman Zippel
@ 2006-09-10 7:51 ` Heiko Carstens
2006-09-10 13:07 ` [patch 1/2] own header file for struct page v3 Heiko Carstens, Heiko Carstens
2006-09-10 13:08 ` [patch 2/2] convert s390 page handling macros to functions v3 Heiko Carstens, Heiko Carstens
2 siblings, 0 replies; 12+ messages in thread
From: Heiko Carstens @ 2006-09-10 7:51 UTC (permalink / raw)
To: Roman Zippel; +Cc: Andrew Morton, linux-mm, linux-kernel, Martin Schwidefsky
> > In order to get of all these problems caused by macros it seems to
> > be a good idea to get rid of them and convert them to static inline
> > functions. Because of header file include order it's necessary to have a
> > seperate header file for the struct page definition.
> >
> > Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> > Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> > ---
> >
> > Patches are against git tree as of today. Better ideas welcome of course.
> >
> > include/linux/mm.h | 64 --------------------------------------------
> > include/linux/page.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 75 insertions(+), 63 deletions(-)
>
> To avoid the explosion in number of small header files each containing a
> single definition, it would be better to generally split between the
> definitions and implementations, so IMO mm_types.h with all the structures
> and defines from mm.h would be better.
That could be done, but I wouldn't know where to start and where to end.
Moving simply all definitions to mm_types.h doesn't seem to be a good
solution. E.g. having something like "struct shrinker" in mm_types.h
seems to be rather pointless IMHO.
Maybe we can simply leave it by just taking the struct page definition
out for now?
--
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] 12+ messages in thread
* [patch 1/2] own header file for struct page v3
2006-09-09 21:05 ` [patch 1/2] own header file for struct page Roman Zippel
2006-09-10 7:51 ` Heiko Carstens
@ 2006-09-10 13:07 ` Heiko Carstens, Heiko Carstens
2006-09-10 13:08 ` [patch 2/2] convert s390 page handling macros to functions v3 Heiko Carstens, Heiko Carstens
2 siblings, 0 replies; 12+ messages in thread
From: Heiko Carstens, Heiko Carstens @ 2006-09-10 13:07 UTC (permalink / raw)
To: Roman Zippel; +Cc: Andrew Morton, linux-mm, linux-kernel, Martin Schwidefsky
This moves the definition of struct page from mm.h into a new header file
mm_types.h.
This is a prereq to fix SetPageUptodate which is broken on s390:
#define SetPageUptodate(_page)
do {
struct page *__page = (_page);
if (!test_and_set_bit(PG_uptodate, &__page->flags))
page_test_and_clear_dirty(_page);
} while (0)
_page gets used twice in this macro which can cause subtle bugs. Using
__page for the page_test_and_clear_dirty call doesn't work since it
causes yet another problem with the page_test_and_clear_dirty macro as
well.
In order to avoid all these problems caused by macros it seems to
be a good idea to get rid of them and convert them to static inline
functions. Because of header file include order it's necessary to have a
seperate header file for the struct page definition.
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
Updated patch: v2:
- against -mm
- changed name to page-struct.h instead of page.h
- moved mem_map declaration to mmzone.h
v3:
- mm_types.h instead of page-struct.h. To be used if someone
wants to move more definitions from mm.h to a seperate
header file.
include/linux/mm.h | 67 -------------------------------------------
include/linux/mm_types.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mmzone.h | 5 +++
3 files changed, 78 insertions(+), 66 deletions(-)
Index: linux-2.6.18-rc6-mm1/include/linux/mm.h
===================================================================
--- linux-2.6.18-rc6-mm1.orig/include/linux/mm.h 2006-09-10 14:40:09.000000000 +0200
+++ linux-2.6.18-rc6-mm1/include/linux/mm.h 2006-09-10 14:45:30.000000000 +0200
@@ -16,6 +16,7 @@
#include <linux/mutex.h>
#include <linux/debug_locks.h>
#include <linux/backing-dev.h>
+#include <linux/mm_types.h>
struct mempolicy;
struct anon_vma;
@@ -215,67 +216,6 @@
struct mmu_gather;
struct inode;
-/*
- * Each physical page in the system has a struct page associated with
- * it to keep track of whatever it is we are using the page for at the
- * moment. Note that we have no way to track which tasks are using
- * a page, though if it is a pagecache page, rmap structures can tell us
- * who is mapping it.
- */
-struct page {
- unsigned long flags; /* Atomic flags, some possibly
- * updated asynchronously */
- atomic_t _count; /* Usage count, see below. */
- atomic_t _mapcount; /* Count of ptes mapped in mms,
- * to show when page is mapped
- * & limit reverse map searches.
- */
- union {
- struct {
- unsigned long private; /* Mapping-private opaque data:
- * usually used for buffer_heads
- * if PagePrivate set; used for
- * swp_entry_t if PageSwapCache;
- * indicates order in the buddy
- * system if PG_buddy is set.
- */
- struct address_space *mapping; /* If low bit clear, points to
- * inode address_space, or NULL.
- * If page mapped as anonymous
- * memory, low bit is set, and
- * it points to anon_vma object:
- * see PAGE_MAPPING_ANON below.
- */
- };
-#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
- spinlock_t ptl;
-#endif
- };
- pgoff_t index; /* Our offset within mapping. */
- struct list_head lru; /* Pageout list, eg. active_list
- * protected by zone->lru_lock !
- */
- /*
- * On machines where all RAM is mapped into kernel address space,
- * we can simply calculate the virtual address. On machines with
- * highmem some memory is mapped into kernel virtual memory
- * dynamically, so we need a place to store that address.
- * Note that this field could be 16 bits on x86 ... ;)
- *
- * Architectures with slow multiplication can define
- * WANT_PAGE_VIRTUAL in asm/page.h
- */
-#if defined(WANT_PAGE_VIRTUAL)
- void *virtual; /* Kernel virtual address (NULL if
- not kmapped, ie. highmem) */
-#endif /* WANT_PAGE_VIRTUAL */
-#ifdef CONFIG_PAGE_OWNER
- int order;
- unsigned int gfp_mask;
- unsigned long trace[8];
-#endif
-};
-
#define page_private(page) ((page)->private)
#define set_page_private(page, v) ((page)->private = (v))
@@ -551,11 +491,6 @@
*/
#include <linux/vmstat.h>
-#ifndef CONFIG_DISCONTIGMEM
-/* The array of struct pages - for discontigmem use pgdat->lmem_map */
-extern struct page *mem_map;
-#endif
-
static __always_inline void *lowmem_page_address(struct page *page)
{
return __va(page_to_pfn(page) << PAGE_SHIFT);
Index: linux-2.6.18-rc6-mm1/include/linux/mmzone.h
===================================================================
--- linux-2.6.18-rc6-mm1.orig/include/linux/mmzone.h 2006-09-10 14:40:09.000000000 +0200
+++ linux-2.6.18-rc6-mm1/include/linux/mmzone.h 2006-09-10 14:40:13.000000000 +0200
@@ -318,6 +318,11 @@
};
#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+#ifndef CONFIG_DISCONTIGMEM
+/* The array of struct pages - for discontigmem use pgdat->lmem_map */
+extern struct page *mem_map;
+#endif
+
/*
* The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
* (mostly NUMA machines?) to denote a higher-level memory zone than the
Index: linux-2.6.18-rc6-mm1/include/linux/mm_types.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.18-rc6-mm1/include/linux/mm_types.h 2006-09-10 14:44:32.000000000 +0200
@@ -0,0 +1,72 @@
+#ifndef _LINUX_MM_TYPES_H
+#define _LINUX_MM_TYPES_H
+
+#include <linux/types.h>
+#include <linux/threads.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+struct address_space;
+
+/*
+ * Each physical page in the system has a struct page associated with
+ * it to keep track of whatever it is we are using the page for at the
+ * moment. Note that we have no way to track which tasks are using
+ * a page, though if it is a pagecache page, rmap structures can tell us
+ * who is mapping it.
+ */
+struct page {
+ unsigned long flags; /* Atomic flags, some possibly
+ * updated asynchronously */
+ atomic_t _count; /* Usage count, see below. */
+ atomic_t _mapcount; /* Count of ptes mapped in mms,
+ * to show when page is mapped
+ * & limit reverse map searches.
+ */
+ union {
+ struct {
+ unsigned long private; /* Mapping-private opaque data:
+ * usually used for buffer_heads
+ * if PagePrivate set; used for
+ * swp_entry_t if PageSwapCache;
+ * indicates order in the buddy
+ * system if PG_buddy is set.
+ */
+ struct address_space *mapping; /* If low bit clear, points to
+ * inode address_space, or NULL.
+ * If page mapped as anonymous
+ * memory, low bit is set, and
+ * it points to anon_vma object:
+ * see PAGE_MAPPING_ANON below.
+ */
+ };
+#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
+ spinlock_t ptl;
+#endif
+ };
+ pgoff_t index; /* Our offset within mapping. */
+ struct list_head lru; /* Pageout list, eg. active_list
+ * protected by zone->lru_lock !
+ */
+ /*
+ * On machines where all RAM is mapped into kernel address space,
+ * we can simply calculate the virtual address. On machines with
+ * highmem some memory is mapped into kernel virtual memory
+ * dynamically, so we need a place to store that address.
+ * Note that this field could be 16 bits on x86 ... ;)
+ *
+ * Architectures with slow multiplication can define
+ * WANT_PAGE_VIRTUAL in asm/page.h
+ */
+#if defined(WANT_PAGE_VIRTUAL)
+ void *virtual; /* Kernel virtual address (NULL if
+ not kmapped, ie. highmem) */
+#endif /* WANT_PAGE_VIRTUAL */
+#ifdef CONFIG_PAGE_OWNER
+ int order;
+ unsigned int gfp_mask;
+ unsigned long trace[8];
+#endif
+};
+
+#endif /* _LINUX_MM_TYPES_H */
--
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] 12+ messages in thread
* [patch 2/2] convert s390 page handling macros to functions v3
2006-09-09 21:05 ` [patch 1/2] own header file for struct page Roman Zippel
2006-09-10 7:51 ` Heiko Carstens
2006-09-10 13:07 ` [patch 1/2] own header file for struct page v3 Heiko Carstens, Heiko Carstens
@ 2006-09-10 13:08 ` Heiko Carstens, Heiko Carstens
2006-09-10 16:25 ` Dave Hansen
2 siblings, 1 reply; 12+ messages in thread
From: Heiko Carstens, Heiko Carstens @ 2006-09-10 13:08 UTC (permalink / raw)
To: Roman Zippel; +Cc: Andrew Morton, linux-mm, linux-kernel, Martin Schwidefsky
Convert s390 page handling macros to functions. In particular this fixes a
problem with s390's SetPageUptodate macro which uses its input parameter
twice which again can cause subtle bugs.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
include/asm-s390/pgtable.h | 85 +++++++++++++++++++++------------------------
include/linux/page-flags.h | 11 ++---
2 files changed, 46 insertions(+), 50 deletions(-)
Index: linux-2.6.18-rc6-mm1/include/linux/page-flags.h
===================================================================
--- linux-2.6.18-rc6-mm1.orig/include/linux/page-flags.h 2006-09-10 14:40:07.000000000 +0200
+++ linux-2.6.18-rc6-mm1/include/linux/page-flags.h 2006-09-10 14:54:08.000000000 +0200
@@ -130,12 +130,11 @@
#define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags)
#ifdef CONFIG_S390
-#define SetPageUptodate(_page) \
- do { \
- struct page *__page = (_page); \
- if (!test_and_set_bit(PG_uptodate, &__page->flags)) \
- page_test_and_clear_dirty(_page); \
- } while (0)
+static inline void SetPageUptodate(struct page *page)
+{
+ if (!test_and_set_bit(PG_uptodate, &page->flags))
+ page_test_and_clear_dirty(page);
+}
#else
#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
#endif
Index: linux-2.6.18-rc6-mm1/include/asm-s390/pgtable.h
===================================================================
--- linux-2.6.18-rc6-mm1.orig/include/asm-s390/pgtable.h 2006-09-10 14:40:07.000000000 +0200
+++ linux-2.6.18-rc6-mm1/include/asm-s390/pgtable.h 2006-09-10 14:54:34.000000000 +0200
@@ -31,9 +31,9 @@
* the S390 page table tree.
*/
#ifndef __ASSEMBLY__
+#include <linux/mm_types.h>
#include <asm/bug.h>
#include <asm/processor.h>
-#include <linux/threads.h>
struct vm_area_struct; /* forward declaration (include/linux/mm.h) */
struct mm_struct;
@@ -604,30 +604,31 @@
* should therefore only be called if it is not mapped in any
* address space.
*/
-#define page_test_and_clear_dirty(_page) \
-({ \
- struct page *__page = (_page); \
- unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \
- int __skey = page_get_storage_key(__physpage); \
- if (__skey & _PAGE_CHANGED) \
- page_set_storage_key(__physpage, __skey & ~_PAGE_CHANGED);\
- (__skey & _PAGE_CHANGED); \
-})
+static inline int page_test_and_clear_dirty(struct page *page)
+{
+ unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+ int skey = page_get_storage_key(physpage);
+
+ if (skey & _PAGE_CHANGED)
+ page_set_storage_key(physpage, skey & ~_PAGE_CHANGED);
+ return skey & _PAGE_CHANGED;
+}
/*
* Test and clear referenced bit in storage key.
*/
-#define page_test_and_clear_young(page) \
-({ \
- struct page *__page = (page); \
- unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \
- int __ccode; \
- asm volatile ("rrbe 0,%1\n\t" \
- "ipm %0\n\t" \
- "srl %0,28\n\t" \
- : "=d" (__ccode) : "a" (__physpage) : "cc" ); \
- (__ccode & 2); \
-})
+static inline int page_test_and_clear_young(struct page *page)
+{
+ unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+ int ccode;
+
+ asm volatile (
+ "rrbe 0,%1\n"
+ "ipm %0\n"
+ "srl %0,28\n"
+ : "=d" (ccode) : "a" (physpage) : "cc" );
+ return ccode & 2;
+}
/*
* Conversion functions: convert a page and protection to a page entry,
@@ -640,32 +641,28 @@
return __pte;
}
-#define mk_pte(pg, pgprot) \
-({ \
- struct page *__page = (pg); \
- pgprot_t __pgprot = (pgprot); \
- unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \
- pte_t __pte = mk_pte_phys(__physpage, __pgprot); \
- __pte; \
-})
-
-#define pfn_pte(pfn, pgprot) \
-({ \
- pgprot_t __pgprot = (pgprot); \
- unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \
- pte_t __pte = mk_pte_phys(__physpage, __pgprot); \
- __pte; \
-})
+static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
+{
+ unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
+
+ return mk_pte_phys(physpage, pgprot);
+}
+
+static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
+{
+ unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
+
+ return mk_pte_phys(physpage, pgprot);
+}
#ifdef __s390x__
-#define pfn_pmd(pfn, pgprot) \
-({ \
- pgprot_t __pgprot = (pgprot); \
- unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \
- pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot)); \
- __pmd; \
-})
+static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
+{
+ unsigned long physpage = __pa((pfn) << PAGE_SHIFT);
+
+ return __pmd(physpage + pgprot_val(pgprot));
+}
#endif /* __s390x__ */
--
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] 12+ messages in thread
* Re: [patch 2/2] convert s390 page handling macros to functions v3
2006-09-10 13:08 ` [patch 2/2] convert s390 page handling macros to functions v3 Heiko Carstens, Heiko Carstens
@ 2006-09-10 16:25 ` Dave Hansen
2006-09-11 4:22 ` Heiko Carstens
0 siblings, 1 reply; 12+ messages in thread
From: Dave Hansen @ 2006-09-10 16:25 UTC (permalink / raw)
To: Heiko Carstens
Cc: Roman Zippel, Andrew Morton, linux-mm, linux-kernel, Martin Schwidefsky
On Sun, 2006-09-10 at 15:08 +0200, Heiko Carstens wrote:
>
> +static inline int page_test_and_clear_dirty(struct page *page)
> +{
> + unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
> + int skey = page_get_storage_key(physpage);
This has nothing to do with your patch at all, but why is 'page -
mem_map' being open-coded here?
I see at least a couple of page_to_phys() definitions on some
architectures. This operation is done enough times that s390 could
probably use the same treatment.
It could at least use a page_to_pfn() instead of the 'page - mem_map'
operation, right?
-- Dave
--
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] 12+ messages in thread
* Re: [patch 2/2] convert s390 page handling macros to functions v3
2006-09-10 16:25 ` Dave Hansen
@ 2006-09-11 4:22 ` Heiko Carstens
0 siblings, 0 replies; 12+ messages in thread
From: Heiko Carstens @ 2006-09-11 4:22 UTC (permalink / raw)
To: Dave Hansen
Cc: Roman Zippel, Andrew Morton, linux-mm, linux-kernel, Martin Schwidefsky
On Sun, Sep 10, 2006 at 09:25:18AM -0700, Dave Hansen wrote:
> On Sun, 2006-09-10 at 15:08 +0200, Heiko Carstens wrote:
> >
> > +static inline int page_test_and_clear_dirty(struct page *page)
> > +{
> > + unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT);
> > + int skey = page_get_storage_key(physpage);
>
> This has nothing to do with your patch at all, but why is 'page -
> mem_map' being open-coded here?
I just changed the defines to functions without thinking about this.. :)
> I see at least a couple of page_to_phys() definitions on some
> architectures. This operation is done enough times that s390 could
> probably use the same treatment.
Yes, even s390 has page_to_phys() as well. But why is it in io.h? Seems
like this is inconsistent across architectures. Also in quite a few
architectures the define looks like this:
#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
A pair of braces is missing around page. Yet another possible subtle bug...
> It could at least use a page_to_pfn() instead of the 'page - mem_map'
> operation, right?
Yes, I will address that in a later patch. Shouldn't stop this one from
being merged, if there aren't any other objections.
Thanks for pointing this out!
--
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] 12+ messages in thread
end of thread, other threads:[~2006-09-11 4:27 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-08 11:17 [patch 1/2] own header file for struct page Heiko Carstens, Heiko Carstens
2006-09-08 16:46 ` Andrew Morton
2006-09-08 18:33 ` Heiko Carstens
2006-09-08 19:06 ` Andrew Morton
2006-09-08 19:47 ` [patch 1/2] own header file for struct page v2 Heiko Carstens, Heiko Carstens
2006-09-08 19:48 ` [patch 2/2] convert s390 page handling macros to functions v2 Heiko Carstens, Heiko Carstens
2006-09-09 21:05 ` [patch 1/2] own header file for struct page Roman Zippel
2006-09-10 7:51 ` Heiko Carstens
2006-09-10 13:07 ` [patch 1/2] own header file for struct page v3 Heiko Carstens, Heiko Carstens
2006-09-10 13:08 ` [patch 2/2] convert s390 page handling macros to functions v3 Heiko Carstens, Heiko Carstens
2006-09-10 16:25 ` Dave Hansen
2006-09-11 4:22 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox