Memory Pre-allocation (mem=xxx)

2 messages, 2 authors, 2002-02-23 · open the first message on its own page

Memory Pre-allocation (mem=xxx)

From: David C. Chiu <hidden>
Date: 2002-02-23 00:42:46

We're working on a project that requires a two megabytes block of
contiguous memory in kernel space. Although it is well documented that
memory can be reserved by using mem=xx arguments during boot time, it is
unclear (to me) as to how a driver can automatically detect the size of
the said reserved block.

At this moment I am 'cheating' by inserting a global variable to save a
copy of total_memory before it gets replaced by __max_memory in
arch/ppc/mm/init.c so that the saved total_memory (containing the real
physical memory size passed in from boot block) is available to my
driver. But I can't help but to feel there has to be a better way to
determine the reserved buffer size. Is there something else that will do
this without having to modify the kernel?

Any comment is appreciated.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

RE: Memory Pre-allocation (mem=xxx)

From: Jim Lewis <hidden>
Date: 2002-02-23 01:54:32

Another way to allocate physically contiguous memory in 2.4 is to use
the alloc_bootmem function. It has to be called during kernel
initialization, though.
-Jim Lewis
-----Original Message-----
From: owner-linuxppc-embedded@lists.linuxppc.org
[mailto:owner-linuxppc-embedded@lists.linuxppc.org]On
Behalf Of David C.
Chiu
Sent: Friday, February 22, 2002 6:43 PM
To: linuxppc-embedded@lists.linuxppc.org
Subject: Memory Pre-allocation (mem=xxx)



We're working on a project that requires a two megabytes block of
contiguous memory in kernel space. Although it is well
documented that
memory can be reserved by using mem=xx arguments during
boot time, it is
unclear (to me) as to how a driver can automatically detect
the size of
the said reserved block.

At this moment I am 'cheating' by inserting a global
variable to save a
copy of total_memory before it gets replaced by __max_memory in
arch/ppc/mm/init.c so that the saved total_memory
(containing the real
physical memory size passed in from boot block) is available to my
driver. But I can't help but to feel there has to be a better way to
determine the reserved buffer size. Is there something else
that will do
this without having to modify the kernel?

Any comment is appreciated.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help