linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qi Yong <qiyong@fc-cn.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-ia64@vger.kernel.org
Subject: Re: [RFC][PATCH 3/9] actual generic PAGE_SIZE infrastructure
Date: Tue, 17 Oct 2006 15:29:34 +0800	[thread overview]
Message-ID: <4534865E.7020504@fc-cn.com> (raw)
In-Reply-To: <20060830221606.40937644@localhost.localdomain>

Dave Hansen wrote:

>* Add _ALIGN_UP() which we'll use now and _ALIGN_DOWN(), just for
>  parity.
>* Define ASM_CONST() macro to help using constants in both assembly
>  and C code.  Several architectures have some form of this, and
>  they will be consolidated around this one.
>* Actually create PAGE_SHIFT and PAGE_SIZE macros
>* For now, require that architectures enable GENERIC_PAGE_SIZE in
>  order to get this new code.  This option will be removed by the
>  last patch in the series, and makes the series bisect-safe.
>* Note that this moves the compiler.h define outside of the
>  #ifdef __KERNEL__, but that's OK because it has its own.
>
>Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
>---
>
> threadalloc-dave/include/asm-generic/page.h |   31 ++++++++++++++++++--
> threadalloc-dave/mm/Kconfig                 |   43 ++++++++++++++++++++++++++++
> 2 files changed, 71 insertions(+), 3 deletions(-)
>
>diff -puN include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure include/asm-generic/page.h
>--- threadalloc/include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure	2006-08-30 15:15:00.000000000 -0700
>+++ threadalloc-dave/include/asm-generic/page.h	2006-08-30 15:15:01.000000000 -0700
>@@ -1,11 +1,36 @@
> #ifndef _ASM_GENERIC_PAGE_H
> #define _ASM_GENERIC_PAGE_H
> 
>+#include <linux/compiler.h>
>+#include <linux/align.h>
>+
> #ifdef __KERNEL__
>-#ifndef __ASSEMBLY__
> 
>-#include <linux/compiler.h>
>+#ifdef __ASSEMBLY__
>+#define ASM_CONST(x) x
>+#else
>+#define __ASM_CONST(x) x##UL
>+#define ASM_CONST(x) __ASM_CONST(x)
>+#endif
>+
>+#ifdef CONFIG_ARCH_GENERIC_PAGE_SIZE
>+
>+#define PAGE_SHIFT      CONFIG_PAGE_SHIFT
>+#define PAGE_SIZE       (ASM_CONST(1) << PAGE_SHIFT)
>  
>

Your generic page.h hides PAGE_SIZE under "#ifdef __KERNEL__".
That would cause severe userland compile failures.

Most archs have PAGE_SIZE visible to userland.
Please keep PAGE_SIZE and its friends outside "#ifdef __KERNEL__".


-- qiyong

>+
>+/*
>+ * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we
>+ * assign PAGE_MASK to a larger type it gets extended the way we want
>+ * (i.e. with 1s in the high bits)
>+ */
>+#define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
> 
>+/* to align the pointer to the (next) page boundary */
>+#define PAGE_ALIGN(addr)        ALIGN(addr, PAGE_SIZE)
>+
>+#endif /* CONFIG_ARCH_GENERIC_PAGE_SIZE */
>+
>+#ifndef __ASSEMBLY__
> #ifndef CONFIG_ARCH_HAVE_GET_ORDER
> /* Pure 2^n version of get_order */
> static __inline__ __attribute_const__ int get_order(unsigned long size)
>@@ -22,7 +47,7 @@ static __inline__ __attribute_const__ in
> }
> 
> #endif	/* CONFIG_ARCH_HAVE_GET_ORDER */
>-#endif /*  __ASSEMBLY__ */
>+#endif  /* __ASSEMBLY__ */
> #endif	/* __KERNEL__ */
> 
> #endif	/* _ASM_GENERIC_PAGE_H */
>  
>
-- 
Qi Yong

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

  parent reply	other threads:[~2006-10-17  7:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-30 22:16 [RFC][PATCH 0/9] generic PAGE_SIZE infrastructure (v4) Dave Hansen
2006-08-30 22:16 ` [RFC][PATCH 2/9] conditionally define generic get_order() (ARCH_HAS_GET_ORDER) Dave Hansen
2006-08-31 18:41   ` Haavard Skinnemoen
2006-08-31 19:51     ` Dave Hansen
2006-08-30 22:16 ` [RFC][PATCH 1/9] put alignment macros in align.h Dave Hansen
2006-08-30 22:16 ` [RFC][PATCH 3/9] actual generic PAGE_SIZE infrastructure Dave Hansen
2006-08-31  0:08   ` Christoph Lameter
2006-08-31 17:57     ` Dave Hansen
2006-08-31 18:06       ` Christoph Lameter
2006-08-31 20:50     ` Dave Hansen
2006-09-05 11:20   ` Martin Waitz
2006-09-05 16:47     ` Dave Hansen
2006-10-17  7:29   ` Qi Yong [this message]
2006-08-30 22:16 ` [RFC][PATCH 4/9] ia64 generic PAGE_SIZE Dave Hansen
2006-08-30 23:57   ` Christoph Lameter
2006-08-31 17:38     ` Dave Hansen
2006-08-31 17:39       ` Christoph Lameter
2006-08-30 22:16 ` [RFC][PATCH 6/9] mips " Dave Hansen
2006-08-30 22:16 ` [RFC][PATCH 5/9] sparc64 " Dave Hansen
2006-08-30 22:27   ` David Miller, Dave Hansen
2006-08-30 22:16 ` [RFC][PATCH 7/9] parisc " Dave Hansen
2006-08-30 22:40   ` Kyle McMartin
2006-08-30 22:48     ` Dave Hansen
2006-08-30 22:16 ` [RFC][PATCH 8/9] powerpc " Dave Hansen
2006-08-30 22:16 ` [RFC][PATCH 9/9] convert the "easy" architectures to " Dave Hansen
2006-08-31  0:33 ` [RFC][PATCH 0/9] generic PAGE_SIZE infrastructure (v4) Paul Mackerras
2006-08-31 21:03   ` Dave Hansen

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=4534865E.7020504@fc-cn.com \
    --to=qiyong@fc-cn.com \
    --cc=haveblue@us.ibm.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox