linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Righi <righi.andrea@gmail.com>
To: Paul Mackerras <paulus@samba.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, balbir@linux.vnet.ibm.com,
	Sudhir Kumar <skumar@linux.vnet.ibm.com>,
	yamamoto@valinux.co.jp, menage@google.com,
	linux-kernel@vger.kernel.org, xemul@openvz.org,
	kamezawa.hiroyu@jp.fujitsu.com, linux-arch@vger.kernel.org
Subject: Re: [PATCH -mm] PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures (v2)
Date: Mon, 16 Jun 2008 10:35:37 +0200 (MEST)	[thread overview]
Message-ID: <485625D9.6040508@gmail.com> (raw)
In-Reply-To: <18517.39513.867328.171299@cargo.ozlabs.ibm.com>

Paul Mackerras wrote:
> Andrea Righi writes:
> 
>> Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
>> include/linux/mm.h.
> 
> I'd rather see it in some other place than this, because
> include/linux/mm.h is a large header that includes quite a lot of
> other stuff.  What's wrong with leaving it in each arch's page.h and
> only changing it on those archs that have both 32-bit and 64-bit
> variants?  Or perhaps there is some other, lower-level header in
> include/linux where it could go?

I think the only evident advantage of this is to have a single
implementation, instead of dealing with (potentially) N different
implementations.

Maybe a different place could be linux/mm_types.h, it's not so small,
but at least it's smaller than linux/mm.h. However, it's a bit ugly to
put a "function" in a file called mm_types.h.

Anyway, I've to say that fixing PAGE_ALIGN and leaving it in each page.h
for now would be surely a simpler solution and would introduce less
potential errors.

> 
>> diff --git a/arch/powerpc/boot/of.c b/arch/powerpc/boot/of.c
>> index 61d9899..6bc72b1 100644
>> --- a/arch/powerpc/boot/of.c
>> +++ b/arch/powerpc/boot/of.c
>> @@ -8,6 +8,7 @@
>>   */
>>  #include <stdarg.h>
>>  #include <stddef.h>
>> +#include <linux/mm.h>
>>  #include "types.h"
>>  #include "elf.h"
>>  #include "string.h"
>> diff --git a/arch/powerpc/boot/page.h b/arch/powerpc/boot/page.h
>> index 14eca30..aa42298 100644
>> --- a/arch/powerpc/boot/page.h
>> +++ b/arch/powerpc/boot/page.h
>> @@ -28,7 +28,4 @@
>>  /* align addr on a size boundary - adjust address up if needed */
>>  #define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
>>  
>> -/* to align the pointer to the (next) page boundary */
>> -#define PAGE_ALIGN(addr)	_ALIGN(addr, PAGE_SIZE)
>> -
>>  #endif				/* _PPC_BOOT_PAGE_H */
> 
> These parts are NAKed, because arch/powerpc/boot is a separate program
> that doesn't use the kernel include files.

OK, so we also shouldn't use the linux/kernel.h's ALIGN() here, but leave
the local _ALIGN() definition, right?

> 
>> diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
>> index cffdf0e..e088545 100644
>> --- a/include/asm-powerpc/page.h
>> +++ b/include/asm-powerpc/page.h
>> @@ -119,9 +119,6 @@ extern phys_addr_t kernstart_addr;
>>  /* align addr on a size boundary - adjust address up if needed */
>>  #define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
>>  
>> -/* to align the pointer to the (next) page boundary */
>> -#define PAGE_ALIGN(addr)	_ALIGN(addr, PAGE_SIZE)
>> -
>>  /*
>>   * Don't compare things with KERNELBASE or PAGE_OFFSET to test for
>>   * "kernelness", use is_kernel_addr() - it should do what you want.
> 
> We had already come across this issue on powerpc, and we fixed it by
> making sure that the type of PAGE_MASK was int, not unsigned int.
> However, I have no objection to using the ALIGN() macro from
> include/linux/kernel.h instead.

Thanks,
-Andrea

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

  reply	other threads:[~2008-06-16  8:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-15 15:23 Andrea Righi
2008-06-15 15:54 ` Andrea Righi
2008-06-15 22:40 ` Paul Mackerras
2008-06-16  8:35   ` Andrea Righi [this message]
2008-06-19 15:57   ` [PATCH -mm] PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures (v3) Andrea Righi

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=485625D9.6040508@gmail.com \
    --to=righi.andrea@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=menage@google.com \
    --cc=paulus@samba.org \
    --cc=skumar@linux.vnet.ibm.com \
    --cc=xemul@openvz.org \
    --cc=yamamoto@valinux.co.jp \
    /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