CONFIG_ARCH_HAS_ATOMIC_UNSIGNED
Subsystems (3)
PATCH 1/1 CONFIG_ARCH_HAS_ATOMIC_UNSIGNED
This reduces another one of the dependencies that struct page's definition has on any arch-specific header files. Currently, only x86_64 uses this, so it's the only architecture that needed to be modified.
---
apw2-dave/arch/x86_64/Kconfig | 4 ++++ apw2-dave/include/asm-x86_64/bitops.h | 2 -- apw2-dave/include/linux/mm.h | 2 +- apw2-dave/include/linux/mmzone.h | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)
arch/x86_64/Kconfig renamed from arch/x86_64/Kconfig~000-CONFIG_ARCH_HAS_ATOMIC_UNSIGNED +4 -0
@@ -193,6 +193,10 @@ config X86_LOCAL_APIC bool default y +config ARCH_HAS_ATOMIC_UNSIGNED + bool + default y + config MTRR bool "MTRR (Memory Type Range Register) support" ---help---
include/linux/mm.h renamed from include/linux/mm.h~000-CONFIG_ARCH_HAS_ATOMIC_UNSIGNED +1 -1
@@ -216,7 +216,7 @@ struct vm_operations_struct {struct mmu_gather ;struct inode ; -#ifdef ARCH_HAS_ATOMIC_UNSIGNED +#ifdef CONFIG_ARCH_HAS_ATOMIC_UNSIGNED typedef unsigned page_flags_t ;#else typedef unsigned long page_flags_t ;
include/linux/mmzone.h renamed from include/linux/mmzone.h~000-CONFIG_ARCH_HAS_ATOMIC_UNSIGNED +1 -1
@@ -388,7 +388,7 @@ extern struct pglist_data contig_page_da#include <asm/mmzone.h> -#if BITS_PER_LONG ==32 || defined(ARCH_HAS_ATOMIC_UNSIGNED ) +#if BITS_PER_LONG ==32 || defined(CONFIG_ARCH_HAS_ATOMIC_UNSIGNED )/* * with 32 bit page->flags field, we reserve 8 bits for node/zone info. * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes.
include/asm-x86_64/bitops.h renamed from include/asm-x86_64/bitops.h~000-CONFIG_ARCH_HAS_ATOMIC_UNSIGNED +0 -2
@@ -411,8 +411,6 @@ static __inline__ int ffs(int x)/* find last set bit */ #define fls (x) generic_fls(x) -#define ARCH_HAS_ATOMIC_UNSIGNED 1 -#endif /* __KERNEL__ */ #endif /* _X86_64_BITOPS_H */
_
--
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 5 lines · Dave Hansen
This reduces another one of the dependencies that struct page's definition has on any arch-specific header files. Currently, only
x86_64uses this, so it's the only architecture that needed to be modified.
That's for page_flags_t, right?
I think it could be dropped right now and just use unsigned long for flags again.
Since the objrmap work the saved 4 bytes in struct page are wasted in padding and I haven't found a way to use them for real space saving again because all other members are 8 byte or paired 4 byte.
Of course if anybody could come up with a way to make struct page smaller it would be very appreciated:
struct page {
page_flags_t flags; /* Atomic flags, some possibly
* updated asynchronously */
<------------ what to do with the 4 byte padding here?
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 */
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 ! */
-Andi
--
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 7 lines · Andi Kleen
Quoted 4 lines · Dave Hansen
This reduces another one of the dependencies that struct page's definition has on any arch-specific header files. Currently, only
x86_64uses this, so it's the only architecture that needed to be modified.That's for
page_flags_t, right?
Yep.
Quoted 2 lines
I think it could be dropped right now and just use unsigned long for flags again.
That's fine with me (and a much simpler patch).
Quoted 3 lines
Since the objrmap work the saved 4 bytes in struct page are wasted in padding and I haven't found a way to use them for real space saving again because all other members are 8 byte or paired 4 byte.
Well, since you asked... :)
In a newer revision of the nonlinear code, Andy Whitcroft has decided to store part of the page_to_pfn() translation directly in page->flags, right next to the zone information. This is a bit of a squeeze on 32-bit arches, but on the 64-bit ones, there's plenty of room since nobody is using the upper 32 bits at all.
I didn't realize that x86_64 had a 32-bit type there, so we probably would have suggested turning it into a 64-bit one eventually.
-- 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 6 lines · Andi Kleen
struct page {
page_flags_tflags; /* Atomic flags, some possibly
* updated asynchronously */<------------ what to do with the 4 byte padding here?
Put the order of the page there for compound pages instead of having that in index?
--
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 7 lines · Christoph Lameter
Quoted 4 lines · Andi Kleen
struct page {
page_flags_tflags; /* Atomic flags, some possibly
* updated asynchronously */
Quoted 5 lines
Quoted 2 lines
<------------ what to do with the 4 byte padding here?Put the order of the page there for compound pages instead of having that in index?
That would waste memory on the 64bit architectures that cannot tolerate 32bit atomic flags or on true 32bit architecture.
Also what's the problem of having it in index?
-Andi
--
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 5 lines · Andi Kleen
Quoted 2 lines
Put the order of the page there for compound pages instead of having that in index?
That would waste memory on the 64bit architectures that cannot tolerate 32bit atomic flags or on true 32bit architecture.
Would be great to have 64 bit atomic support to fill this hole then.
Quoted 1 line
Also what's the problem of having it in index?
It implies that huge pages cannot be handled in the same way as regular pages. F.e. if huge pages should ever be able to map files then huge pages will also need page->index. Maybe its best to encode the order in a 64 bit page flags on 64 bit machines? It will be zero in most cases and one could then simply check for having a hugepage and get to the first page without a pointer if the huge pages are properly aligned in their address space.
--
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 9 lines · Christoph Lameter
Quoted 5 lines · Andi Kleen
Quoted 2 lines
Put the order of the page there for compound pages instead of having that in index?
That would waste memory on the 64bit architectures that cannot tolerate 32bit atomic flags or on true 32bit architecture.
Would be great to have 64 bit atomic support to fill this hole then.
I think you lost me. How would that help?
To fill the hole you would need a 4 byte member with padding to move around, but there isn't one. You cannot also just add one because it would waste memory on 32bit archs and other 64bit archs.
-Andi
--
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 · Andi Kleen
Quoted 5 lines · Christoph Lameter
Quoted 3 lines · Andi Kleen
Quoted 2 lines
Put the order of the page there for compound pages instead of having that in index?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
That would waste memory on the 64bit architectures that cannot tolerate 32bit atomic flags or on true 32bit architecture.
Would be great to have 64 bit atomic support to fill this hole then.
I think you lost me. How would that help?
It would fill the hole on 64 bits if atomic_t would have the native word size.
Quoted 3 lines
To fill the hole you would need a 4 byte member with padding to move around, but there isn't one. You cannot also just add one because it would waste memory on 32bit archs and other 64bit archs.
There is no clean solution here but I just wanted to indicate what I would like to see there if you want to use the space.
--
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 · Christoph Lameter
Quoted 9 lines · Andi Kleen
Quoted 8 lines · Christoph Lameter
Quoted 5 lines · Andi Kleen
Quoted 2 lines
Put the order of the page there for compound pages instead of having that in index?
That would waste memory on the 64bit architectures that cannot tolerate 32bit atomic flags or on true 32bit architecture.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Would be great to have 64 bit atomic support to fill this hole then.
I think you lost me. How would that help?
It would fill the hole on 64 bits if
atomic_twould have the native word size.
The problem is that that 64bit atomic_t type would end up unaligned. While that would work in theory on x86-64 I suspect it would be slow even there. And it would probably not work anywhere else.
And as Dave said they plan to use the upper 32bit of flags for CONFIG_NONLINEAR anyways, so it's not even possible.
-Andi
--
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>