Re: kernel memory



Kernel virtual address space is used for a number of things. Page tables, PFN database, cache manager regions, registry pages, mapped data transfers, etc... Pat of this are the memory pools, from which you can allocate memory for your drivers.

The pools will attempt to grow (up to some limits that I don’t know off the top of my head, and which I suspect are adjustable) but probably won't ever take up all of the kernel space, since we still need room to handle direct mapped I/O transfers.

That's all virtual space. Physical pages are allocated to all of these things as well as to the address spaces of processes. You can allocate physical memory using a DDI like MmAllocatePagesForMdl and then map those into the system address space.

Don't fall into the mistaken assumption that your driver is the only thing running on the system. You have to share the system resources with everyone else. That's probably the easiest way to explain why you cannot allocate 1GB of non-paged pool for yourself :)

-p

--
This posting is provided "AS IS" with no warranties, and confers no rights.


"kobi n" <kobin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:37C6B380-DAD0-4661-B94F-E5634E19A61F@xxxxxxxxxxxxxxxx
Hi,
i have a very basic question regarding kernel memory allocation.

is allocating kernel memory always performed on some kind of pool (paged or
nopaged) ? is there any memory allocation methods that acts on a "regular"
memory, meaning type of memory other than paged or nopaged ?
since kernel memory space is about 1G, i'm a bit confused since both the
paged pool and the non paged pool are smaller than 1G. so what with the rest
of the memory ? can i allocate more than the pools have to offer ? if so, how
? since all the routines deal with a pool type (paged or non paged).

thanks a lot,
kobi.

.



Relevant Pages

  • Re: Help!!! Memory allocation!!!
    ... I'm trying to map the continuous memory to user space address. ... dont know if the MmAllocateContiguousMemory didnt allocate the continuous ... memory from non-paged pool but from paged pool or some other places, ... Lock it first whatever it is allocated from nonpaged pool or not ...
    (microsoft.public.development.device.drivers)
  • Re: Sharing memory between kernelspace and userspace
    ... deallocate, on a totally dynamic basis, userspace ... Let userspace allocate shared memory visible to multiple ... and pass that into the kernel for it to write to. ...
    (Linux-Kernel)
  • Re: Assigning data structures to certain memory locations during porting
    ... "Dynamically allocating and freeing memory is often discouraged in ... there's no possibility of running ouf of memory later on." ... I thought the primary reason for dynamic allocation was to allocate ... The pool is just a preallocated chunk of memory which is ...
    (comp.arch.embedded)
  • [PATCH 1/2] x86: reinstate numa remap for SPARSEMEM on x86 NUMA systems
    ... Recent kernels have been panic'ing trying to allocate memory early in boot, ... at kernel virtual address 0. ...
    (Linux-Kernel)
  • Re: ISP1760 driver crashes
    ... I recompiled the kernel without HIGHMEM and it works. ... the memory is highmem and not in kernel so the buffer is NULL ... usb-storage doesn't allocate the memory. ...
    (Linux-Kernel)