maximum allocated memory by linux-kernel module

南楼画角 提交于 2019-12-12 04:14:40

问题


I want to write a module whose task is to capture the incoming packets without sending them to the user space application & doing some modification on the captured packet. then this module will send this packet for transmission to the NIC.

But main problem is that my module is very big in size & it also does a lot of processing. So will it be good to do this processing inside kernel module or should we pass the information & packet to the user space for processing to avoid complexity.

& i m doing it only for getting packet processing very quick.
so maximum how much memory could be allocated by a linux-kernel module.


回答1:


A network packet will always be faster when running in kernel space instead of user-space. Remember, that it has to be copied to user-space, which is an expensive operation. However, not everything should be running in kernel space as this would make the system very unstable, because every bug is a potential kernel crash. So if you want to program your application using kernel or user space heavily depends on your specifications.

In contrast, the amount of memory to be allocated does not matter at all. Using kmalloc() in the linux module you can allocate as much memory as there is physically available in the system, so you should be fine.



来源:https://stackoverflow.com/questions/13268824/maximum-allocated-memory-by-linux-kernel-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!