linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Paul Mackerras <paulus@samba.org>,
	David Miller <davem@redhat.com>,
	linux-kernel@vger.kernel.org,
	linuxppc-embedded@lists.linuxppc.org
Subject: [PATCH] Add gfp_mask to get_vm_area()
Date: Tue, 1 Oct 2002 14:54:39 +1000	[thread overview]
Message-ID: <20021001045439.GU10265@zax> (raw)

Linus, please consider this patch.  It renames get_vm_area() to
__get_vm_area() and adds a gfp_mask parameter which is passed on to
kmalloc().  get_vm_area(size,flags) is then defined as as
__get_vm_area(size,flags,GFP_KERNEL) to avoid messing with existing
callers.

We need this in order to sanely make pci_alloc_consistent() (and other
consistent allocation functions) obey the DMA-mapping.txt rules on PPC
embedded machines (specifically the requirement that it be callable
from interrupt context).

DaveM seems to think it's ok :-)

diff -urN /home/dgibson/kernel/linuxppc-2.5/include/linux/vmalloc.h linux-bluefish/include/linux/vmalloc.h
--- /home/dgibson/kernel/linuxppc-2.5/include/linux/vmalloc.h	2002-09-20 14:36:15.000000000 +1000
+++ linux-bluefish/include/linux/vmalloc.h	2002-10-01 14:29:10.000000000 +1000
@@ -32,7 +32,8 @@
 /*
  *	Lowlevel-APIs (not for driver use!)
  */
-extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
+extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, int gfp_mask);
+#define get_vm_area(size, flags) __get_vm_area(size, flags, GFP_KERNEL)
 extern struct vm_struct *remove_vm_area(void *addr);
 extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
 			struct page ***pages);
diff -urN /home/dgibson/kernel/linuxppc-2.5/mm/vmalloc.c linux-bluefish/mm/vmalloc.c
--- /home/dgibson/kernel/linuxppc-2.5/mm/vmalloc.c	2002-09-20 14:36:26.000000000 +1000
+++ linux-bluefish/mm/vmalloc.c	2002-10-01 14:30:02.000000000 +1000
@@ -181,21 +181,22 @@


 /**
- *	get_vm_area  -  reserve a contingous kernel virtual area
+ *	__get_vm_area  -  reserve a contingous kernel virtual area
  *
  *	@size:		size of the area
  *	@flags:		%VM_IOREMAP for I/O mappings or VM_ALLOC
+ *	@gfp_mask:	gfp flags to pass to kmalloc()
  *
  *	Search an area of @size in the kernel virtual mapping area,
  *	and reserved it for out purposes.  Returns the area descriptor
  *	on success or %NULL on failure.
  */
-struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
+struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, int gfp_mask)
 {
 	struct vm_struct **p, *tmp, *area;
 	unsigned long addr = VMALLOC_START;

-	area = kmalloc(sizeof(*area), GFP_KERNEL);
+	area = kmalloc(sizeof(*area), gfp_mask);
 	if (unlikely(!area))
 		return NULL;


-- 
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

                 reply	other threads:[~2002-10-01  4:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021001045439.GU10265@zax \
    --to=david@gibson.dropbear.id.au \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    --cc=paulus@samba.org \
    --cc=torvalds@transmeta.com \
    /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;
as well as URLs for NNTP newsgroup(s).