The use of __init (and __initdata for data items) can reduce the amount of memory used by the kernel. There is no harm in marking module initialization functions with __init, even though currently there is no benefit either. Management of initialization sections has not been implemented yet for modules, but it’s a possible enhancement for the future.
LDD2第二章Explicit Initialization and Cleanup Functions I just want to repeat __init is used to free the memory used. Some memories are just used once and can be reclaimed later."但是我不知道kernel释放这些初始化内存的控制路径在什么位置", it is controlled by gcc.Actually when you compile it, the compiler will process it the correct way.After execution, reclaim the memory. It is not linux related, but gcc related. GCC is infamous for its bad doc, but I remember the feature is documented in detail.so better read gcc manual or $info gcc.
Hope it helps. yes, this is an attribute as jjww said.
页:
1
[2]