Super pages
Dr. Baud
drbaud at yahoo.com
Wed Feb 23 16:55:00 UTC 2011
> On 23/02/2011 14:03, Dr. Baud wrote:
> >
> > In general, is it unadvisable to disable super pages?
>
> I don't think there would be any effect on the stability of operation if
> you disable superpages, but generally (except in cases of CPU bugs) you
> would not need to. Your system should operate a bit faster with
> superpages enabled.
When is the memory allocated via contigmalloc freed? I have a test kernel
module that allocates memory in 8MB chucks until contigmalloc says enough (the
ginormous.c/Makefile attachment). I also have a bash script that displays the
interesting memory related kernel state variables (the mem attachement).
When I load and unload the kernel module and display the VM pages stats I
never see the wired pages nor free pages change:
vm.pmap.pg_ps_enabled: 1
SYSTEM MEMORY INFORMATION:
mem_phys: = 2138693632 ( 2039MB) Physical memory tunable
mem_user: = 2107297792 ( 2009MB) User space memory available
mem_real: = 2146893824 ( 2047MB) Maximum physical pages
mem_all: = 2075402240 ( 1979MB) [100%] Virual memory pages
mem_cache: = 0 ( 0MB) [ 0%] Cached: almost avail. to allocat
mem_inactive:= 7360512 ( 7MB) [ 0%] Inactive: recently unreferenced
mem_active: + 8765440 ( 8MB) [ 0%] Active: recently referenced
mem_wire: 31395840 ( 29MB) [ 1%] Wired: disabled for paging out
mem_free: + 2027589632 ( 1933MB) [ 97%] Free: fully available
-------------- ------------ -----------
mem_hw: = 2147483648 ( 2048MB) Virual memory (cached, etc.)
kldload /sys/modules/ginormous/ginormous.ko
Ginormous module loading
Ginormous contigmalloc failed(229):
SYSTEM MEMORY INFORMATION:
mem_phys: = 2138693632 ( 2039MB) Physical memory tunable
mem_user: = 180330496 ( 171MB) User space memory available
mem_real: = 2146893824 ( 2047MB) Maximum physical pages
mem_all: = 2075402240 ( 1979MB) [100%] Virual memory pages
mem_cache: = 22237184 ( 21MB) [ 1%] Cached: almost avail. to allocat
mem_inactive:= 253952 ( 0MB) [ 0%] Inactive: recently unreferenced
mem_active: + 2387968 ( 2MB) [ 0%] Active: recently referenced
mem_wire: 1958363136 ( 1867MB) [ 94%] Wired: disabled for paging out
mem_free: + 91795456 ( 87MB) [ 4%] Free: fully available
-------------- ------------ -----------
mem_hw: = 2147483648 ( 2048MB) Virual memory (cached, etc.)
kldunload ginormous
Ginormous module unloading
Warning: memory type GINORMOUS leaked memory on destroy (229 allocations,
1920991232 bytes leaked).
SYSTEM MEMORY INFORMATION:
mem_phys: = 2138693632 ( 2039MB) Physical memory tunable
mem_user: = 180314112 ( 171MB) User space memory available
mem_real: = 2146893824 ( 2047MB) Maximum physical pages
mem_all: = 2075402240 ( 1979MB) [100%] Virual memory pages
mem_cache: = 21565440 ( 20MB) [ 1%] Cached: almost avail. to allocat
mem_inactive:= 413696 ( 0MB) [ 0%] Inactive: recently unreferenced
mem_active: + 2842624 ( 2MB) [ 0%] Active: recently referenced
mem_wire: 1958379520 ( 1867MB) [ 94%] Wired: disabled for paging out
mem_free: + 91807744 ( 87MB) [ 4%] Free: fully available
-------------- ------------ -----------
mem_hw: = 2147483648 ( 2048MB) Virual memory (cached, etc.)
Note that this behavior occurs whether superpages are enabled or not. Anyone
have
and explanation?
Dr.
-------------- next part --------------
#include <sys/types.h>
#include <sys/module.h>
#include <sys/malloc.h>
#include <sys/systm.h> /* uprintf */
#include <sys/param.h> /* defines used in kernel.h */
#include <sys/kernel.h> /* types used in module initialization */
#include <sys/conf.h> /* cdevsw struct */
MALLOC_DEFINE(M_GINORMOUS, "GINORMOUS", "Ginormous Kernel Module");
#define BUFSIZE (8*1024*1024)
#define NMALLOCS 241
static int
ginormous_loader(struct module *m, int what, void *arg)
{
int err = 0;
void *mem[NMALLOCS];
switch (what)
{
case MOD_LOAD: /* kldload */
{
int i;
printf("Ginormous module loading\n");
for (i = 0; i < NMALLOCS; i++) {
if ((mem[i] = contigmalloc( BUFSIZE,
M_GINORMOUS,
0,
0UL,
~0UL,
PAGE_SIZE,
0)) == NULL) {
printf("Ginormous contigmalloc failed(%d):\n", i);
break;
}
}
}
break;
case MOD_UNLOAD:
printf("Ginormous module unloading\n");
break;
default:
err = EINVAL;
break;
}
return(err);
}
DEV_MODULE(ginormous, ginormous_loader, NULL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 267 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110223/82570cf2/Makefile.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mem
Type: application/octet-stream
Size: 3433 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110223/82570cf2/mem.obj
More information about the freebsd-hackers
mailing list