Re: [PATCH 16 of 66] special pmd_trans_* functions

Andrea Arcangeli
2010-11-25T17:11:46Z

On Thu, Nov 18, 2010 at 12:51:12PM +0000, Mel Gorman wrote:
> Usually it is insisted upon that this looks like
>
> static inline int pmd_trans_huge(pmd) {
> return 0;
> }
>
> I understand it's to avoid any possibility of side-effets though to have type
> checking and I am 99% certain the compiler still does the right thing. Still,
> with no obvious side-effects here;
>
> Acked-by: Mel Gorman <mel@csn.ul.ie>

It doesn't seem to fail build on x86-64 and x86, so it should build
for all other archs too. I'm keeping this incremental at the end just
in case.

diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -471,10 +471,20 @@ extern void untrack_pfn_vma(struct vm_ar
#endif

#ifndef CONFIG_TRANSPARENT_HUGEPAGE
-#define pmd_trans_huge(pmd) 0
-#define pmd_trans_splitting(pmd) 0
+static inline int pmd_trans_huge(pmd_t pmd)
+{
+ return 0;
+}
+static inline int pmd_trans_splitting(pmd_t pmd)
+{
+ return 0;
+}
#ifndef __HAVE_ARCH_PMD_WRITE
-#define pmd_write(pmd) ({ BUG(); 0; })
+static inline int pmd_write(pmd_t pmd)
+{
+ BUG();
+ return 0;
+}
#endif /* __HAVE_ARCH_PMD_WRITE */
#endif