Skip to contentSkip to conversation

Pageflags: Eliminate PG_xxx aliases

PATCH Pekka Enberg 3 participants 11 messages Mar 18, 2008 – Mar 31, 2008 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 7 lines · Christoph Lameter

#ifdef CONFIG_HIGHMEM
/*
* Must use a macro here due to header dependency issues. page_zone() is not
* available at this point.
*/
-#define PageHighMem(__p) is_highmem(page_zone(page))
+#define PageHighMem(__p) is_highmem(page_zone(__p))

Looks like this hunk should be in some other patch.

--
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>

#3 lore raw
Quoted 10 lines · Pekka Enberg
Quoted 7 lines · Christoph Lameter

#ifdef CONFIG_HIGHMEM
/*
* Must use a macro here due to header dependency issues. page_zone() is not
* available at this point.
*/
-#define PageHighMem(__p) is_highmem(page_zone(page))
+#define PageHighMem(__p) is_highmem(page_zone(__p))

Looks like this hunk should be in some other patch.

True....

--
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>

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#5 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 8 lines · On Tue, 18 Mar 2008 11:20:01 -0700 Christoph Lameter <[email protected]> wrote:

NR_PAGEFLAGS specifies the number of page flags we are using.

Quoted 1 line

From that we can calculate the number of bits leftover that can

be used for zone, node (and maybe the sections id). There is no need anymore for FLAGS_RESERVED if we use NR_PAGEFLAGS.

Use the new methods to make NR_PAGEFLAGS available via the preprocessor. NR_PAGEFLAGS is used to calculate field boundaries in the page flags fields. These field widths have

For some reason this isn't working on mips - include/linux/bounds.h has no #define for NR_PAGEFLAGS.

http://userweb.kernel.org/~akpm/cross-compilers/ has the i386->mips toolchain which I'm using.

--
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>

#6 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 2 lines · Andrew Morton

For some reason this isn't working on mips - include/linux/bounds.h has no #define for NR_PAGEFLAGS.

Likely an asm issue? Are there no definitions at all in include/linux/bounds.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>

maintainer
#7 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 7 lines · On Fri, 28 Mar 2008 11:51:09 -0700 (PDT) Christoph Lameter <[email protected]>…
Quoted 2 lines · Andrew Morton

For some reason this isn't working on mips - include/linux/bounds.h has no #define for NR_PAGEFLAGS.

Likely an asm issue? Are there no definitions at all in include/linux/bounds.h?

None - just the skeleton comments and ifdefs.

--
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>

#8 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Fri, 28 Mar 2008 11:51:09 -0700 (PDT) Christoph Lameter <[email protected]>…

On Fri, 28 Mar 2008, Andrew Morton wrote:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

For some reason this isn't working on mips - include/linux/bounds.h has no #define for NR_PAGEFLAGS.

Likely an asm issue? Are there no definitions at all in include/linux/bounds.h?

None - just the skeleton comments and ifdefs.

Guess the asm is different for mips:

kernel/bounds.c does:

#define DEFINE(sym, val) \
        asm volatile("\n->" #sym " %0 " #val : : "i" (val))

mips wants something different.

#define offset(string, val) \
        __asm__("\n@@@" string "%0" : : "i" (val))

Argh. Do an #ifdef MIPS or add a definition in an arch specific .h file somewhere?

The asm could be different. gas is pretty uniform but some arches may not be using gas?

--
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>

maintainer
#9 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 22 lines · On Fri, 28 Mar 2008 12:04:00 -0700 (PDT) Christoph Lameter <[email protected]>…
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Fri, 28 Mar 2008 11:51:09 -0700 (PDT) Christoph Lameter <[email protected]>…

On Fri, 28 Mar 2008, Andrew Morton wrote:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

For some reason this isn't working on mips - include/linux/bounds.h has no #define for NR_PAGEFLAGS.

Likely an asm issue? Are there no definitions at all in include/linux/bounds.h?

None - just the skeleton comments and ifdefs.

Guess the asm is different for mips:

kernel/bounds.c does:

#define DEFINE(sym, val) \
        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
Quoted 7 lines

mips wants something different.

#define offset(string, val) \
        __asm__("\n@@@" string "%0" : : "i" (val))

Argh. Do an #ifdef MIPS or add a definition in an arch specific .h file somewhere?

The usual way is to add asm-generic/foo.h which has the usual implementation and then have each arch's asm/foo.h include asm-generic/foo.h. Architectires which have special needs would provide a custom implementation and do not include the asm-generic file.

Quoted 2 lines

The asm could be different. gas is pretty uniform but some arches may not be using gas?

I'm unaware of any other assemblers being used. If they are, they'd need to be fairly gassy to be able to build the kernel. Maybe Intel's ICC uses its own assembler, dunno - hopefully it uses gas.

Why do we use gas at all here? All we're doing is converting

->NR_PAGEFLAGS 18 __NR_PAGEFLAGS #

into

#define NR_PAGEFLAGS 18

which can be done with sed or whatever?

--
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>

#10 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 9 lines · Andrew Morton

Why do we use gas at all here? All we're doing is converting

->NR_PAGEFLAGS 18 __NR_PAGEFLAGS #

into

#define NR_PAGEFLAGS 18

which can be done with sed or whatever?

Only the compiler knows the value of __NR_PAGEFLAGS since it was defined via enum. We are generating an object file and then extract the symbols. This is the same process as used in arch/*/asm-offsets.*

--
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>

maintainer
#11 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 6 lines · On Sat, 29 Mar 2008 13:22:30 -0700 (PDT) Christoph Lameter <[email protected]>…
Quoted 4 lines · Andrew Morton

Why do we use gas at all here? All we're doing is converting

->NR_PAGEFLAGS 18 __NR_PAGEFLAGS #

Quoted 8 lines
Quoted 5 lines

into

#define NR_PAGEFLAGS 18

which can be done with sed or whatever?

Only the compiler knows the value of __NR_PAGEFLAGS since it was defined via enum. We are generating an object file and then extract the symbols.

I know. I suggested that we process the .s file with sed, generating the #defines for the .h file. There is no need to assemble the .s file!

Quoted 1 line

This is the same process as used in arch/*/asm-offsets.*

Maybe that wasn't the best way of doing 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>

#12 lore raw

Re: [patch 4/9] Pageflags: Get rid of FLAGS_RESERVED

Quoted 3 lines · Andrew Morton
Quoted 1 line

This is the same process as used in arch/*/asm-offsets.*

Maybe that wasn't the best way of doing it.

Is there any alternative? It would be best if we could get the c compiler to define a linker symbol with the values that we need without asm. I guess we could somehow stick this into ldlinux.lds.S but that is going to be ugly as well.

I checked and all arches use the same asm to define a symbol except for mips. If we allow an arch to override the way to define a symbol then it also works on mips.

From: Christoph Lameter <[email protected]>
Subject: Allow override of definition for asm constant

MIPS has a different way of defining asm constants which causes troubles for bounds.h generation.

Add a new per arch CONFIG variable

CONFIG_ASM_SYMBOL_PREFIX

which can be set to define an alternate header for asm constant definitions. Use this for MIPS to make bounds determination work right.

---
 arch/mips/Kconfig |    7 +++++++
 kernel/bounds.c   |   11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
arch/mips/Kconfig +7 -0
Index: linux-2.6.25-rc5-mm1/arch/mips/Kconfig
===================================================================
@@ -2019,6 +2019,13 @@ config I8253
 config ZONE_DMA32
 	bool
 
+#
+# Used to override gas symbol setup in kernel/bounds.c.
+#
+config ASM_SYMBOL_PREFIX
+	string
+	default "@@@#define "
+
 source "drivers/pcmcia/Kconfig"
 
 source "drivers/pci/hotplug/Kconfig"
kernel/bounds.c +10 -1
Index: linux-2.6.25-rc5-mm1/kernel/bounds.c
===================================================================
@@ -9,8 +9,17 @@
 #include <linux/page-flags.h>
 #include <linux/mmzone.h>
 
+#ifdef CONFIG_ASM_SYMBOL_PREFIX
+#define PREFIX CONFIG_ASM_SYMBOL_PREFIX
+#else
+/*
+ * Standard gas way of defining an asm symbol
+ */
+#define PREFIX "->"
+#endif
+
 #define DEFINE(sym, val) \
-	asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+	asm volatile("\n" PREFIX #sym " %0 " : : "i" (val))
 
 #define BLANK() asm volatile("\n->" : :)
 

--
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>

maintainer
#13 lore raw

Re: [patch 0/9] Page flags V3: Cleanup and reorg

In reply to a message not in the archive
Quoted 1 line · On Tue, 18 Mar 2008 11:19:57 -0700 Christoph Lameter <[email protected]> wrote:

A set of patches that attempts to improve page flag handling.

sh allmodconfig blows up with various unsatisfied link-time references to swapper_space.

this:

include/linux/mm.h renamed from include/linux/mm.h~a +4 -1
@@ -605,9 +605,12 @@ static inline struct address_space *page
 	struct address_space *mapping = page->mapping;
 
 	VM_BUG_ON(PageSlab(page));
+#ifdef CONFIG_SWAP
 	if (unlikely(PageSwapCache(page)))
 		mapping = &swapper_space;
-	else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
+	else
+#endif
+	if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
 		mapping = NULL;
 	return mapping;
 }

_

fixes it, but it shouldn't, unless it's a cimpiler bug. Could you investigate please, check that we're not adding unintended code bloat for some reason?

http://userweb.kernel.org/~akpm/cross-compilers/ has the toolchain.

--
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>