linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: enforce sane MAX_ORDER
@ 2008-09-24 13:24 Johannes Berg
  2008-09-24 14:05 ` Kumar Gala
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2008-09-24 13:24 UTC (permalink / raw)
  To: linuxppc-dev list; +Cc: Paul Mackerras

powerpc uses CONFIG_FORCE_MAX_ZONEORDER, and some things depend on it
being at least 10 when 64k pages are not configured (notably the dart
iommu code with CONFIG_PM). The defaults are fine, but when going from a
64K pages config to one without 64K pages, MAX_ORDER stays at 9 which is
too low for 4K pages.

This patch makes the Kconfig enforce at least the defaults, I used 999
as the upper bound for no particular reason other than that it's plenty.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---

--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -415,8 +415,11 @@ config PPC_64K_PAGES
 
 config FORCE_MAX_ZONEORDER
 	int "Maximum zone order"
+	range 9 999 if PPC_64K_PAGES
 	default "9" if PPC_64K_PAGES
+	range 13 999 if PPC64 && !PPC_64K_PAGES
 	default "13" if PPC64 && !PPC_64K_PAGES
+	range 11 999
 	default "11"
 	help
 	  The kernel memory allocator divides physically contiguous memory

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc: enforce sane MAX_ORDER
  2008-09-24 13:24 [PATCH] powerpc: enforce sane MAX_ORDER Johannes Berg
@ 2008-09-24 14:05 ` Kumar Gala
  2008-09-24 14:13   ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2008-09-24 14:05 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list, Paul Mackerras


On Sep 24, 2008, at 8:24 AM, Johannes Berg wrote:

> powerpc uses CONFIG_FORCE_MAX_ZONEORDER, and some things depend on it
> being at least 10 when 64k pages are not configured (notably the dart
> iommu code with CONFIG_PM). The defaults are fine, but when going  
> from a
> 64K pages config to one without 64K pages, MAX_ORDER stays at 9  
> which is
> too low for 4K pages.
>
> This patch makes the Kconfig enforce at least the defaults, I used 999
> as the upper bound for no particular reason other than that it's  
> plenty.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
>
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -415,8 +415,11 @@ config PPC_64K_PAGES
>
> config FORCE_MAX_ZONEORDER
> 	int "Maximum zone order"
> +	range 9 999 if PPC_64K_PAGES
> 	default "9" if PPC_64K_PAGES
> +	range 13 999 if PPC64 && !PPC_64K_PAGES
> 	default "13" if PPC64 && !PPC_64K_PAGES
> +	range 11 999
> 	default "11"
> 	help
> 	  The kernel memory allocator divides physically contiguous memory

Hope about setting the upper bound to 32 or 64.  Since I believe this  
in effect 2^FORCE_MAX_ZONEORDER, so 999 is just insane.  I'd almost  
prefer something like 16 since that might still be in the realm of  
reasonable and able to work.

- k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc: enforce sane MAX_ORDER
  2008-09-24 14:05 ` Kumar Gala
@ 2008-09-24 14:13   ` Johannes Berg
  2008-09-24 14:16     ` Kumar Gala
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2008-09-24 14:13 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev list, Paul Mackerras

[-- Attachment #1: Type: text/plain, Size: 1675 bytes --]

On Wed, 2008-09-24 at 09:05 -0500, Kumar Gala wrote:

> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -415,8 +415,11 @@ config PPC_64K_PAGES
> >
> > config FORCE_MAX_ZONEORDER
> > 	int "Maximum zone order"
> > +	range 9 999 if PPC_64K_PAGES
> > 	default "9" if PPC_64K_PAGES
> > +	range 13 999 if PPC64 && !PPC_64K_PAGES
> > 	default "13" if PPC64 && !PPC_64K_PAGES
> > +	range 11 999
> > 	default "11"
> > 	help
> > 	  The kernel memory allocator divides physically contiguous memory
> 
> Hope about setting the upper bound to 32 or 64.  

Works for me, I'm interested in the lower bound because if you set
CONFIG_PM on a machine with dart iommu and set this to 9 then the thing
will BUG_ON during boot.

> Since I believe this  
> in effect 2^FORCE_MAX_ZONEORDER, so 999 is just insane.  

Indeed it is, and no argument that it's insane. But it's not limited at
all right now, so you can in theory set it to 10000, write a kernel
module that calls alloc_pages(1000) and have it fail because not enough
memory is available, rather than failing because of the MAX_ORDER check.

> I'd almost  
> prefer something like 16 since that might still be in the realm of  
> reasonable and able to work.

with 4k pages that would be 256M memory, that seems well possible to
allocate. Even 20 might still be possible (4G memory) if you allocate it
early enough at boot and have a lot of memory (on a 64-bit system).

On the other hand, why bother limiting it? If people set it too large in
their config all that will happen is that it takes a bit longer to fail
to allocate such a ridiculous amount of memory.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc: enforce sane MAX_ORDER
  2008-09-24 14:13   ` Johannes Berg
@ 2008-09-24 14:16     ` Kumar Gala
  2008-09-24 14:29       ` [PATCH v2] " Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2008-09-24 14:16 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list, Paul Mackerras


On Sep 24, 2008, at 9:13 AM, Johannes Berg wrote:

> On Wed, 2008-09-24 at 09:05 -0500, Kumar Gala wrote:
>
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -415,8 +415,11 @@ config PPC_64K_PAGES
>>>
>>> config FORCE_MAX_ZONEORDER
>>> 	int "Maximum zone order"
>>> +	range 9 999 if PPC_64K_PAGES
>>> 	default "9" if PPC_64K_PAGES
>>> +	range 13 999 if PPC64 && !PPC_64K_PAGES
>>> 	default "13" if PPC64 && !PPC_64K_PAGES
>>> +	range 11 999
>>> 	default "11"
>>> 	help
>>> 	  The kernel memory allocator divides physically contiguous memory
>>
>> Hope about setting the upper bound to 32 or 64.
>
> Works for me, I'm interested in the lower bound because if you set
> CONFIG_PM on a machine with dart iommu and set this to 9 then the  
> thing
> will BUG_ON during boot.
>
>> Since I believe this
>> in effect 2^FORCE_MAX_ZONEORDER, so 999 is just insane.
>
> Indeed it is, and no argument that it's insane. But it's not limited  
> at
> all right now, so you can in theory set it to 10000, write a kernel
> module that calls alloc_pages(1000) and have it fail because not  
> enough
> memory is available, rather than failing because of the MAX_ORDER  
> check.
>
>> I'd almost
>> prefer something like 16 since that might still be in the realm of
>> reasonable and able to work.
>
> with 4k pages that would be 256M memory, that seems well possible to
> allocate. Even 20 might still be possible (4G memory) if you  
> allocate it
> early enough at boot and have a lot of memory (on a 64-bit system).
>
> On the other hand, why bother limiting it? If people set it too  
> large in
> their config all that will happen is that it takes a bit longer to  
> fail
> to allocate such a ridiculous amount of memory.

We'll I'm ok with that, but I dont think we should be values that make  
no sense.  64 would seem the max even in a 64-bit system.

- k

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] powerpc: enforce sane MAX_ORDER
  2008-09-24 14:16     ` Kumar Gala
@ 2008-09-24 14:29       ` Johannes Berg
  2008-09-24 16:08         ` Timur Tabi
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2008-09-24 14:29 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev list, Paul Mackerras

powerpc uses CONFIG_FORCE_MAX_ZONEORDER, and some things depend on it
being at least 10 when 64k pages are not configured (notably the dart
iommu code with CONFIG_PM). The defaults are fine, but when going from a
64K pages config to one without 64K pages, MAX_ORDER stays at 9 which is
too low for 4K pages.

This patch makes the Kconfig enforce at least the defaults.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---

> We'll I'm ok with that, but I dont think we should be values that
> make  
> no sense.  64 would seem the max even in a 64-bit system.

Indeed, it makes little sense to allow you to set more than the address
space, so here's a version with max 64.

--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -415,8 +415,11 @@ config PPC_64K_PAGES
 
 config FORCE_MAX_ZONEORDER
 	int "Maximum zone order"
+	range 9 64 if PPC_64K_PAGES
 	default "9" if PPC_64K_PAGES
+	range 13 64 if PPC64 && !PPC_64K_PAGES
 	default "13" if PPC64 && !PPC_64K_PAGES
+	range 11 64
 	default "11"
 	help
 	  The kernel memory allocator divides physically contiguous memory

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] powerpc: enforce sane MAX_ORDER
  2008-09-24 14:29       ` [PATCH v2] " Johannes Berg
@ 2008-09-24 16:08         ` Timur Tabi
  0 siblings, 0 replies; 6+ messages in thread
From: Timur Tabi @ 2008-09-24 16:08 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev list, Paul Mackerras

On Wed, Sep 24, 2008 at 9:29 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:

> Indeed, it makes little sense to allow you to set more than the address
> space, so here's a version with max 64.

Acked-by: Timur Tabi <timur@freescale.com>

However, the max is actually less than 64.  Assuming a 64-bit address
space, the maximum number of pages in one allocation can be
2^(64-PAGE_SHIFT).  For 4KB pages, the max value for
FORCE_MAX_ZONEORDER is 53.  For 64KB pages, the max is 49.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-24 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-24 13:24 [PATCH] powerpc: enforce sane MAX_ORDER Johannes Berg
2008-09-24 14:05 ` Kumar Gala
2008-09-24 14:13   ` Johannes Berg
2008-09-24 14:16     ` Kumar Gala
2008-09-24 14:29       ` [PATCH v2] " Johannes Berg
2008-09-24 16:08         ` Timur Tabi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).