Skip to contentSkip to conversation

Replace "vmalloc_node" with "vmalloc" for no-mmu architectures in oprofile driver

PATCH In review Luke Yang 2 participants 3 messages Feb 28, 2006

Subsystems (2)
lore
Share & tools
lore

Luke Yang

author
#0 lore raw

PATCH 1/1 Replace "vmalloc_node" with "vmalloc" for no-mmu architectures in oprofile driver

Hi,

This is a fix to the oprofile driver. It calls "vmalloc_node()" but
no-mmu CPUs do not have that function. "vmalloc()" is OK for no-mmu CPUs.

Index: linux-2.6/drivers/oprofile/cpu_buffer.c
===================================================================
--- linux-2.6/drivers/oprofile/cpu_buffer.c 2006-02-16
16:16:35.000000000 +0800
+++ linux-2.6/drivers/oprofile/cpu_buffer.c 2006-02-16
16:20:58.000000000 +0800
@@ -51,9 +51,13 @@

        for_each_online_cpu(i) {
                struct oprofile_cpu_buffer * b = &cpu_buffer[i];
-
+
+#ifdef MMU
                b->buffer = vmalloc_node(sizeof(struct op_sample) * buffer_size,
                        cpu_to_node(i));
+#else
+               b->buffer = vmalloc(sizeof(struct op_sample) * buffer_size);
+#endif
                if (!b->buffer)
                        goto fail;

--
Best regards,
Luke Yang
[email protected]; [email protected]

#1 lore raw
Quoted 15 lines · Luke Yang

This is a fix to the oprofile driver. It calls "vmalloc_node()" but
no-mmu CPUs do not have that function. "vmalloc()" is OK for no-mmu CPUs.

Index: linux-2.6/drivers/oprofile/cpu_buffer.c
===================================================================
--- linux-2.6/drivers/oprofile/cpu_buffer.c 2006-02-16
16:16:35.000000000 +0800
+++ linux-2.6/drivers/oprofile/cpu_buffer.c 2006-02-16
16:20:58.000000000 +0800
@@ -51,9 +51,13 @@

Quoted 12 lines
         for_each_online_cpu(i) {
                 struct oprofile_cpu_buffer * b = &cpu_buffer[i];
 -
 +
 +#ifdef MMU
                 b->buffer = vmalloc_node(sizeof(struct op_sample) * buffer_size,
                         cpu_to_node(i));
 +#else
 +               b->buffer = vmalloc(sizeof(struct op_sample) * buffer_size);
 +#endif
                 if (!b->buffer)
                         goto fail;

You wanted CONFIG_MMU there.

A better fix is to provide vmalloc_node() on nommu architectures. COuld you compile-test this please?

mm/nommu.c renamed from mm/nommu.c~nommu-implement-vmalloc_node +7 -1
@@ -53,7 +53,6 @@ DECLARE_RWSEM(nommu_vma_sem);
 struct vm_operations_struct generic_file_vm_ops = {
 };
 
-EXPORT_SYMBOL(vmalloc);
 EXPORT_SYMBOL(vfree);
 EXPORT_SYMBOL(vmalloc_to_page);
 EXPORT_SYMBOL(vmalloc_32);
@@ -205,6 +204,13 @@ void *vmalloc(unsigned long size)
 {
        return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
 }
+EXPORT_SYMBOL(vmalloc);
+
+void *vmalloc_node(unsigned long size, int node)
+{
+	return vmalloc(size);
+}
+EXPORT_SYMBOL(vmalloc_node);
 
 /*
  *	vmalloc_32  -  allocate virtually continguos memory (32bit addressable)

_

author
#2 lore raw
Quoted 1 line · Andrew Morton

You wanted CONFIG_MMU there.

Yes.

Quoted 3 lines

A better fix is to provide vmalloc_node() on nommu architectures. COuld you compile-test this please?

Tested. Then my patch is obsolete. Thanks!

Quoted 25 lines
mm/nommu.c 2006-02-27 19:31:53.000000000 -0800 renamed from mm/nommu.c~nommu-implement-vmalloc_node 2006-02-27 19:30:47.000000000 -0800 +7 -1
@@ -53,7 +53,6 @@ DECLARE_RWSEM(nommu_vma_sem);
 struct vm_operations_struct generic_file_vm_ops = {
 };
 
-EXPORT_SYMBOL(vmalloc);
 EXPORT_SYMBOL(vfree);
 EXPORT_SYMBOL(vmalloc_to_page);
 EXPORT_SYMBOL(vmalloc_32);
@@ -205,6 +204,13 @@ void *vmalloc(unsigned long size)
 {
        return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
 }
+EXPORT_SYMBOL(vmalloc);
+
+void *vmalloc_node(unsigned long size, int node)
+{
+       return vmalloc(size);
+}
+EXPORT_SYMBOL(vmalloc_node);
 
 /*
  *     vmalloc_32  -  allocate virtually continguos memory (32bit addressable)
Quoted 3 lines

_

--
Best regards,
Luke Yang
[email protected]; [email protected]