linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] alpha: fix vmalloc breakage
@ 2009-01-07 23:01 Ivan Kokshaysky
  2009-01-11 23:04 ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Kokshaysky @ 2009-01-07 23:01 UTC (permalink / raw)
  To: Nick Piggin, Andrew Morton; +Cc: Richard Henderson, linux-kernel

On alpha, we have to map some stuff in the VMALLOC space very
early in the boot process (to make SRM console callbacks work
and so on, see arch/alpha/mm/init.c). For old VM allocator,
we just manually placed a vm_struct onto the global vmlist
and this worked for ages.
Unfortunately, the new allocator isn't aware of this, so it constantly
tries to allocate the VM space which is already in use, making vmalloc
on alpha defunct.

This patch forces KVA to import vmlist entries on init.

Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
---
 mm/vmalloc.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index c5db9a7..0dd9c2e 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -24,6 +24,7 @@
 #include <linux/rbtree.h>
 #include <linux/radix-tree.h>
 #include <linux/rcupdate.h>
+#include <linux/bootmem.h>
 
 #include <asm/atomic.h>
 #include <asm/uaccess.h>
@@ -984,6 +985,8 @@ EXPORT_SYMBOL(vm_map_ram);
 
 void __init vmalloc_init(void)
 {
+	struct vmap_area *va;
+	struct vm_struct *tmp;
 	int i;
 
 	for_each_possible_cpu(i) {
@@ -996,6 +999,16 @@ void __init vmalloc_init(void)
 		vbq->nr_dirty = 0;
 	}
 
+	/* Import existing vmlist entries. */
+	for (tmp = vmlist; tmp; tmp = tmp->next) {
+		va = alloc_bootmem(sizeof(struct vmap_area));
+		if (!va)
+			break;
+		va->flags = tmp->flags | VM_VM_AREA;
+		va->va_start = (unsigned long)tmp->addr;
+		va->va_end = va->va_start + tmp->size;
+		__insert_vmap_area(va);
+	}
 	vmap_initialized = true;
 }
 

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

* Re: [PATCH] alpha: fix vmalloc breakage
  2009-01-07 23:01 [PATCH] alpha: fix vmalloc breakage Ivan Kokshaysky
@ 2009-01-11 23:04 ` Johannes Weiner
  2009-01-12 11:35   ` Ivan Kokshaysky
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Weiner @ 2009-01-11 23:04 UTC (permalink / raw)
  To: Ivan Kokshaysky
  Cc: Nick Piggin, Andrew Morton, Richard Henderson, linux-kernel

On Thu, Jan 08, 2009 at 02:01:44AM +0300, Ivan Kokshaysky wrote:
> On alpha, we have to map some stuff in the VMALLOC space very
> early in the boot process (to make SRM console callbacks work
> and so on, see arch/alpha/mm/init.c). For old VM allocator,
> we just manually placed a vm_struct onto the global vmlist
> and this worked for ages.
> Unfortunately, the new allocator isn't aware of this, so it constantly
> tries to allocate the VM space which is already in use, making vmalloc
> on alpha defunct.
> 
> This patch forces KVA to import vmlist entries on init.
> 
> Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> ---
>  mm/vmalloc.c |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index c5db9a7..0dd9c2e 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -24,6 +24,7 @@
>  #include <linux/rbtree.h>
>  #include <linux/radix-tree.h>
>  #include <linux/rcupdate.h>
> +#include <linux/bootmem.h>
>  
>  #include <asm/atomic.h>
>  #include <asm/uaccess.h>
> @@ -984,6 +985,8 @@ EXPORT_SYMBOL(vm_map_ram);
>  
>  void __init vmalloc_init(void)
>  {
> +	struct vmap_area *va;
> +	struct vm_struct *tmp;
>  	int i;
>  
>  	for_each_possible_cpu(i) {
> @@ -996,6 +999,16 @@ void __init vmalloc_init(void)
>  		vbq->nr_dirty = 0;
>  	}
>  
> +	/* Import existing vmlist entries. */
> +	for (tmp = vmlist; tmp; tmp = tmp->next) {
> +		va = alloc_bootmem(sizeof(struct vmap_area));
> +		if (!va)
> +			break;

You don't need this check, alloc_bootmem() panics when it fails.

	Hannes

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

* Re: [PATCH] alpha: fix vmalloc breakage
  2009-01-11 23:04 ` Johannes Weiner
@ 2009-01-12 11:35   ` Ivan Kokshaysky
  0 siblings, 0 replies; 3+ messages in thread
From: Ivan Kokshaysky @ 2009-01-12 11:35 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Nick Piggin, Andrew Morton, Richard Henderson, linux-kernel

On Mon, Jan 12, 2009 at 12:04:30AM +0100, Johannes Weiner wrote:
> > +		va = alloc_bootmem(sizeof(struct vmap_area));
> > +		if (!va)
> > +			break;
> 
> You don't need this check, alloc_bootmem() panics when it fails.

Ah, indeed. Thanks.

Ivan.

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

end of thread, other threads:[~2009-01-12 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-07 23:01 [PATCH] alpha: fix vmalloc breakage Ivan Kokshaysky
2009-01-11 23:04 ` Johannes Weiner
2009-01-12 11:35   ` Ivan Kokshaysky

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