How to signal kernel that shared library is not in use by any process anymore ?
greg at kroah.com
Thu Dec 27 04:43:56 EST 2018
On Thu, Dec 27, 2018 at 10:47:42AM +0300, Lev Olshvang wrote:
> Hello Greg,
> Thanks for you your reply.
> It help me to better express my question
> >From the application I can access /proc/self/maps and see which memory is mapped for my library I do not intend to use after application passes init phase.
> I would like to unmap this memory region, but since I do not have file descriptor for this so I can not do this.
Why do you care? The loader should handle all of this for you
> Only kernel can unmap this memory for me,
> I am willing to pass library name or address to system cal, but IMHO such system call does not exist.
> Should I rely on memory manager which will use reuse this pages because they will never page faulted back ?
Yes you should.
> I am afraid that since this is C++ lib, some pages are modified and will not be considered clean ?
That depends on your code, if it is still in use, yes, it will not be
freed, you have control over that as this is your userspace code. There
is nothing in the kernel you can do about this, sorry, please just fix
up your application.
More information about the Kernelnewbies