Messages in this thread | | | Subject | Re: freeing a static after one use only? | Date | Fri, 18 Feb 2000 22:30:17 -0300 | From | Horst von Brand <> |
| |
Anton Altaparmakov <aia21@cus.cam.ac.uk> said: > On Fri, 18 Feb 2000, Peter T. Breuer wrote: > [snip] > > Modules are apparently in a space that can be swapped out. Should I > [snip]
> Is that always the case? - Or would it happen only if the ref count is 0?
As long as the module is in use, it will stay in RAM. Linux doesn't swap/page/whatever anything in the kernel (and modules are part of the kernel). The Hackers That Be decreed that the (enormous) extra complexity buys too litle to be worth it.
> I'm asking because I am currently writting a driver for a pci card (just > started) and if the module were to be swapped out when it was doing a > busmaster transfer I could imagine the computer crashing...I am sure this > would be the case with most modules providing important hwaccess system > services.
You'd probably be transferring data to/from a kmalloc()ed o vmalloc()ed area, or perhaps even directly to a buffer in userspace, I think. You must plan on several processes using your driver concurrently, so you can't rely on local variables.
> Sorry if the answer to my question is obvious but I am fairly new to > linux kernel development. - Feel free to point out where I can find some > information about this...
You should take a look at Rubini's "Linux Device Drivers". It is quite dated (it concentrates on 2.0, mostly), but gives a good overview. A edition for 2.4 (and beyond? ;) is in the works, just don't hold your breath. Coriolis has a series of books on Linux kernel internals, haven't ever seen one nearby. so I can't say. Check f.ex. amazon.com for books on Linux, and read the reviews.
Good luck! -- Horst von Brand vonbrand@sleipnir.valparaiso.cl Casilla 9G, Viña del Mar, Chile +56 32 672616
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |