get_vm_area and GFP_KERNEL

David Grothe (dave@gcom.com)
Thu, 22 Oct 1998 12:33:27 -0500


Hello:

The routine get_vm_area calls kmalloc passing GFP_KERNEL. Get_vm_area
is called from vremap (2.0 kernels) and ioremap (2.1 kernels). These
routines are used to map physical memory (as in PCI device registers) to
kernel address space.

The problem: If these routines are called from a bottom half task queue
routine then kmalloc thinks that it is being called from interrupt level
without GFP_ATOMIC and prints a message to that effect.

Would any harm be done by changing this?

These would be the patches:

Kernel version 2.0.36:

--- vmalloc.c Wed Jun 3 17:17:50 1998
+++ vmalloc.new.c Thu Oct 22 12:25:41 1998
@@ -239,7 +239,7 @@
void *addr;
struct vm_struct **p, *tmp, *area;

- area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
+ area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_ATOMIC);
if (!area)
return NULL;
addr = (void *) VMALLOC_START;

Kernel version 2.1.120:

--- vmalloc.c Fri Sep 18 15:43:33 1998
+++ vmalloc.new.c Thu Oct 22 12:24:35 1998
@@ -155,7 +155,7 @@
unsigned long addr;
struct vm_struct **p, *tmp, *area;

- area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
+ area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_ATOMIC);
if (!area)
return NULL;
addr = VMALLOC_START;

To the casual observer, it looks safe. Will someone make these
modifications to the kernel source?

Thanks,
Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/