move 'struct page' into its own header
Subsystems (2)
RFC PATCH 1/1 move 'struct page' into its own header
There are currently 24 places in the tree where struct page is predeclared. However, a good number of these places also have to do some kind of arithmetic on it, and end up using macros because static inlines wouldn't have the type fully definied at compile-time.
But, in reality, struct page has very few dependencies on outside macros or functions, and doesn't really need to be a part of the header include mess which surrounds many of the VM headers.
So, put 'struct page' into structpage.h, along with a nasty comment telling everyone to keep their grubby mitts out of the file.
Now, we can use static inlines for almost any 'struct page' operations with no problems, and get rid of many of the predeclarations.
---
apw2-dave/include/linux/mm.h | 55 -------------------------- apw2-dave/include/linux/structpage.h | 73 +++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 54 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~003-move-structpage +1 -54
@@ -13,6 +13,7 @@#include <linux/rbtree.h> #include <linux/prio_tree.h> #include <linux/fs.h> +#include <linux/structpage.h> struct mempolicy ;struct anon_vma ;
@@ -216,60 +217,6 @@ struct vm_operations_struct {struct mmu_gather ;struct inode ; -#ifdef ARCH_HAS_ATOMIC_UNSIGNED -typedef unsigned page_flags_t ; -#else -typedef unsigned long page_flags_t ; -#endif - -/* -* 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 { -page_flags_t 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. -*/ -unsigned long private;/* Mapping-private opaque data: -* usually used for buffer_heads -* if PagePrivate set; used for -* swp_entry_t if PageSwapCache -* When page is free, this indicates -* order in the buddy system. -*/ -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. -*/ -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 their architecture's Kconfig -*/ -#if defined(CONFIG_WANT_PAGE_VIRTUAL ) -void *virtual;/* Kernel virtual address (NULL if -not kmapped, ie. highmem) */ -#endif /* CONFIG_WANT_PAGE_VIRTUAL */ -}; -/* * FIXME: take this include out, include page-flags.h in * files which need it (119 of them)
include/linux/structpage.h new file +73 -0
73 lines not on this page · raw message
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Dave Hansen
There are currently 24 places in the tree where struct page is predeclared. However, a good number of these places also have to do some kind of arithmetic on it, and end up using macros because static inlines wouldn't have the type fully definied at compile-time.
But, in reality, struct page has very few dependencies on outside macros or functions, and doesn't really need to be a part of the header include mess which surrounds many of the VM headers.
Quoted 6 lines
So, put 'struct page' into
structpage.h, along with a nasty comment telling everyone to keep their grubby mitts out of the file.Now, we can use static inlines for almost any 'struct page' operations with no problems, and get rid of many of the predeclarations.
What about calling it page.h? structfoo.h sounds like a really strange name. And while you're at it page-flags.h should probably be merged into it.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Dave Hansen
So, put 'struct page' into
structpage.h, along with a nasty comment telling everyone to keep their grubby mitts out of the file.What about calling it
page.h?structfoo.hsounds like a really strange name.
The only reason I didn't do that is that there is already an asm/page.h. But, linux/page.h would be a fine name, too.
Quoted 2 lines
And while you're at it
page-flags.hshould probably be merged into it.
The only tricky part might be page-flags.h includes asm/pgtable.h, which (on i386) includes linux/slab.h, which includes asm/page.h. This might somewhat restrict the number of places that the new header can be included. As it stands, it can be included (and get you a full definition of struct page) almost anywhere.
But, I'm not quite sure why page-flags.h even needs asm/pgtable.h. I just took it out in i386, and it still compiles just fine. Maybe it is needed for another architecture.
-- Dave
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Dave Hansen
But, I'm not quite sure why
page-flags.heven needsasm/pgtable.h. I just took it out in i386, and it still compiles just fine. Maybe it is needed for another architecture.
Removing that include is also fine on ARM.
Signature · 9 lines
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>