Re: A hole in kernel space!

Matti Aarnio (matti.aarnio@zmailer.org)
Wed, 6 Nov 2002 14:19:18 +0200


On Wed, Nov 06, 2002 at 05:27:50PM +0530, Pannaga Bhushan wrote:
> Hi all,
> I am looking for a setup where I need to have a certain amount
> of data always available to the kernel. The size of data I am looking at
> is abt 40MB(preferably, but I will settle for 20MB too) . So the normal
> kmalloc will not help me.

Will vmalloc() help ? The allocated memory is in special
vmalloc address space (which is limited!) within the kernel,
but accesses to it go via page-mapping tables, thus while it
is virtually contiguous, physically it might be well scattered.

What properties do you need, to be exact ?

You are writing some sort of a device driver for a device that
has somewhat stupid direct-memory-access facilities ?

> if yes, are the pages corresponding to this region swappable or
> is it that since this hole appears in kernel image, it is locked to a
> physical space and this is never swapped. (basically, i want by data
> in kernel space always available to kernel without having to bother
> abt swapping the pages back)

Both kmalloc() and vmalloc() allocate kernel space memory that
is unswappable, and therefore can not be allocated in excessive
amounts.

Doing things in BIGMEM fashion will let you have gigabytes of
in-core memory, but to access it, you must go thru the hoops
(in i686 architecture) each time you access a page of it.

> Thanx in advance,
> Pannaga Bhushan

/Matti Aarnio
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/