Howdy. I've been running 2.4.24-1um very happily for a good long time.
Since April, I believe. But I've just noticed that kmalloc does not seem
to recover memory. Here I've cooked up some demonstration code:
sh-2.03# free
total used free shared buffers cached
Mem: 29524 4540 24984 0 140 2824
^^^^^
-/+ buffers/cache: 1576 27948
Swap: 0 0 0
sh-2.03# insmod mem.o
tiny driver loaded
(this module uses kmalloc to allocate 1000 pages in its init function,
and will release it in its exit function)
sh-2.03# free
total used free shared buffers cached
Mem: 29524 8684 20840 0 140 2824
^^^^^
-/+ buffers/cache: 5720 23804
Swap: 0 0 0
sh-2.03# rmmod mem
tiny driver unloaded
sh-2.03# free
total used free shared buffers cached
Mem: 29524 8680 20844 0 140 2824
^^^^^
-/+ buffers/cache: 5716 23808
Swap: 0 0 0
Same mem usage! Nothing released. I am running UML under kernel 2.6.3,
where it also shows timing anomalies - any sleep takes ages to complete.
Here's my test code:
#include <linux/major.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/blk.h>
int linux_version_code = LINUX_VERSION_CODE;
#define MAX_TINY 1024
static char ** tiny_cache;
static int max_tiny = MAX_TINY;
static int __init
tiny_init (void)
{
int i, err;
tiny_cache = kmalloc(sizeof(char *) * max_tiny, GFP_KERNEL);
for (i = 0; i < max_tiny; i++) {
tiny_cache[i] = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!tiny_cache[i])
goto error_out;
}
printk (KERN_INFO "tiny driver loaded\n");
return 0;
error_out:
printk (KERN_ERR "tiny driver failed to load\n");
while (--i >= 0) {
kfree(tiny_cache[i]);
}
kfree(tiny_cache);
return -EINVAL;
}
static void __exit
tiny_cleanup (void)
{
int i;
for (i = 0; i < max_tiny; i++) {
kfree (tiny_cache[i]);
}
kfree(tiny_cache);
printk (KERN_INFO "tiny driver unloaded\n");
}
module_init (tiny_init);
module_exit (tiny_cleanup);
Peter
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel