From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Fri, 5 Aug 2011 12:06:30 -0700 Subject: Reboot not calling module_exit of LKM In-Reply-To: References: Message-ID: <20110805190630.GA15499@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, Aug 05, 2011 at 11:39:16AM -0700, Ramesh.P wrote: > Hi, > > Good day! > > When a system is rebooted, the loadable kernel modules 'module_exit' > functions are not called. I see this behavior in a custom kernel. My > questions are > > a. Is this applicable in mainline/normal kernel too? Yes. > b. If yes, what are the reasons? (One reason may be, not to get into > new problems while cleaning up the module) You don't need to unload a module as the machine is about to be turned off. > c. Is there anyway for the kernel module to know the system is getting > rebooted? (Apart from letting userspace to indicate the kernel > module). Yes, hook to the reboot notifier.