Re: Doubt regarding memory usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 27 Jan 2006 15:21:25 +0530, srikanth <sri@xxxxxxxxxxxxxxxxxx> wrote:
>
> Suppose that i am having a module mymod.o of 10MB size.
> My doubt is -
>
> 1) can i delete the file mymod.o after loading the module i.e after
> insmod mymod.o (Actually i deleted it and used the module by my user
> process without any problem.. but not sure whether it is right to do so)
>

Yes, I think you can easily delete the module/.ko file after loading
it because after insmod its loaded in memory and till system reboot or
rmmod it remains in memory; so its safe to delete the module/.ko file
:)

> 2) I see that the /proc/meminfo details the increase in used memory by
> ~10MB (almost the same size as of the mymod.o file )after loading the
> module.
>
> With this observation, can i assume that the kernel has made a copy of
> the mymod.o and hence will not refer the deleted file later. I am aware
> of demand paging concept in kernel but have no idea whether it will play
> a role in loadable modules.
>

Yes, after loading module kernel/os keeps the copy of code in the
memory. And kernel memory is not swappable (means in kernel and kernel
modules demand paging isn't present) so kernel will always use
physical memory. By the way what kind of module (what it does) you
have which has ~10MB size ? :)

> Can any one plz explain this with respect to executables & loadable
> modules.(If it is different for both cases)
>

Loadable Kernel modules and Executables are always loaded in memory
and later it won't use it executable/module binary file from storage
(CMIIW)


> Also Plz refer some literature or links for memory usage
>

For this search google and you will definetly find many docs for it.
And you can also look for distribution docs for administrators giving
details and parameters for getting/setting memory usage (like look
docs related to Redhat EL 3) !

--
Fawad Lateef

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux