* How to get rid of unused data in LKM
@ 2002-07-24 11:39 Matthias Fuchs
2002-07-24 15:49 ` Wolfgang Denk
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Fuchs @ 2002-07-24 11:39 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
I am writing a LKM that contains a huge constant array of data that is used
as firmware for a PCI card that is connected to the system where the LKM is loaded.
The module_init function writes the constant data array into the PCI card's RAM and triggers
a CPU on that card to jump to the firmware code. This works fine.
But after doing so, the firmware data is still wasting kernel memory on the host system
and is not used anymore.
How can I free that memory ? Is there a better way to handle that data ?
Currently I have a global variable in my module code:
unsigned char firmware[] = { ..., .... ,.... about 1.4 Meg, ...}
The firmware data (about 1.4 Meg) must be linked with the LKM.
Any idea ?
Matthias
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: How to get rid of unused data in LKM
2002-07-24 11:39 How to get rid of unused data in LKM Matthias Fuchs
@ 2002-07-24 15:49 ` Wolfgang Denk
2002-07-24 16:21 ` John Tyner
0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Denk @ 2002-07-24 15:49 UTC (permalink / raw)
To: Matthias Fuchs; +Cc: linuxppc-embedded
In message <3D3E91E6.4000500@esd-electronics.com> you wrote:
>
> I am writing a LKM that contains a huge constant array of data that is used
> as firmware for a PCI card that is connected to the system where the LKM is loaded.
>
> The module_init function writes the constant data array into the PCI card's RAM and triggers
> a CPU on that card to jump to the firmware code. This works fine.
Why don't you load the firmware using some ioctl() _after_ loading
the module?
> But after doing so, the firmware data is still wasting kernel memory on the host system
> and is not used anymore.
> How can I free that memory ? Is there a better way to handle that data ?
If you really think you must link the data with the module: Declare
it using "__initdata" ?
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd@denx.de
This is an unauthorized cybernetic announcement.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to get rid of unused data in LKM
2002-07-24 15:49 ` Wolfgang Denk
@ 2002-07-24 16:21 ` John Tyner
0 siblings, 0 replies; 3+ messages in thread
From: John Tyner @ 2002-07-24 16:21 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: Matthias Fuchs, linuxppc-embedded
> > But after doing so, the firmware data is still wasting kernel memory on the host system
> > and is not used anymore.
> > How can I free that memory ? Is there a better way to handle that data ?
>
> If you really think you must link the data with the module: Declare
> it using "__initdata" ?
I was under the impression that data like this is not thrown away when
compiled as a module... only when compiled directly into the kernel. Is
this not true?
I think Wolfgang's ioctl idea is a much better way to go in this case.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-07-24 16:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-24 11:39 How to get rid of unused data in LKM Matthias Fuchs
2002-07-24 15:49 ` Wolfgang Denk
2002-07-24 16:21 ` John Tyner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).