linux-um archives
 help / color / mirror / Atom feed
From: blaisorblade_spam@yahoo.it
To: jdike@addtoit.com
Cc: user-mode-linux-devel@lists.sourceforge.net, blaisorblade_spam@yahoo.it
Subject: [uml-devel] [patch 1/1] Fix malloc-use-vmalloc
Date: Sun, 04 Jul 2004 12:56:32 +0200	[thread overview]
Message-ID: <20040704105632.DC0B378A@zion.localdomain> (raw)


* Avoid allocating more than one page at once: that can require
moving pages around to have two contiguos pages, so we're better
with vmalloc.
* Make sure we free() someway, inside __wrap_free.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
---

 linux-2.4.26-paolo/arch/um/main.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff -puN arch/um/main.c~malloc-use-vmalloc-fix arch/um/main.c
--- linux-2.4.26/arch/um/main.c~malloc-use-vmalloc-fix	2004-07-04 12:52:43.887588064 +0200
+++ linux-2.4.26-paolo/arch/um/main.c	2004-07-04 12:52:43.889587760 +0200
@@ -168,7 +168,7 @@ void *__wrap_malloc(int size)
 
 	if(!CAN_KMALLOC())
 		return(__real_malloc(size));
-	else if(size < 128 * 1024) /* kmalloc is good for only 128K */
+	else if(size <= PAGE_SIZE) /* finding contiguos pages is hard */
 		ret = um_kmalloc(size);
 	else ret = um_vmalloc(size);
 
@@ -213,8 +213,11 @@ void __wrap_free(void *ptr)
 			kfree(ptr);
 		else if((addr >= start_vm) && (addr <= end_vm))
 			vfree(ptr);
+		else
+			__real_free(ptr);
 	}
-	else __real_free(ptr);
+	else
+		__real_free(ptr);
 }
 
 /*
_


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

             reply	other threads:[~2004-07-04 10:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-04 10:56 blaisorblade_spam [this message]
2004-07-13 17:57 ` [uml-devel] Re: [patch 1/1] Fix malloc-use-vmalloc Jeff Dike
2004-07-22 15:55   ` BlaisorBlade
2004-07-26 18:18     ` Jeff Dike

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=20040704105632.DC0B378A@zion.localdomain \
    --to=blaisorblade_spam@yahoo.it \
    --cc=jdike@addtoit.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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