lkml.org 
[lkml]   [2000]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectMAX_MAP_COUNT arbitrary? Request to change
I'm the author of a malloc debugger (http://fscked.org/proj/njamd.shtml), and
I was trying to pin down some bugs people were reporting about not being able
to debug large apps despite having plenty of ram. Eventually I paired it down
to the Linux mm system rejecting map requests if the number of mappings
exceeded MAX_MAP_COUNT. In include/linux/sched.h, it is defined as 65536, and
the comment seems to indicate that this was an arbitrary choice. Well it turns
out that my malloc debugger was hitting this limit for behemoths such as
Mozilla. Would it be possible to change this to something less arbitrary,
like ULONG_MAX>>PAGE_SHIFT (the number of pages in the address space)?

I realize that it is probably a bit pretentious of me to ask MAX_MAP_COUNT to
be changed for just my debugger, but I think that the number of pages in the
address space is a much better choice than some arbitrarily chosen magic
number, no?

Here's the patch, which seems to introduce no problems on my system during a
simple stress test to exceed the old limit.

diff -ur linux.old/include/linux/sched.h linux-2.4.0test8/include/linux/sched.h
--- linux.old/include/linux/sched.h Sun Oct 1 05:06:20 2000
+++ linux-2.4.0test8/include/linux/sched.h Sun Oct 1 04:02:31 2000
@@ -187,8 +187,9 @@
{ NULL, } \
}

-/* Maximum number of active map areas.. This is a random (large) number */
-#define MAX_MAP_COUNT (65536)
+/* Maximum number of active map areas. This is the number of pages that fit in
+ * the address space */
+#define MAX_MAP_COUNT (ULONG_MAX >> PAGE_SHIFT)

/* Number of map areas at which the AVL tree is activated. This is arbitrary. */
#define AVL_MIN_MAP_COUNT 32
--
Mike Perry
http://so.fscked.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.022 / U:1.612 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site