OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 2/2] move unneeded data to initdata section
Re: [PATCH 2/2] move unneeded data to initdata section [message #23353 is a reply to message #23351] Thu, 15 November 2007 19:17 Go to previous messageGo to previous message
den is currently offline  den
Messages: 494
Registered: December 2005
Senior Member
Sam Ravnborg wrote:
> On Thu, Nov 15, 2007 at 11:19:26AM -0700, Eric W. Biederman wrote:
>> Sam Ravnborg <sam@ravnborg.org> writes:
>>
>>> On Thu, Nov 15, 2007 at 05:42:04PM +0300, Denis V. Lunev wrote:
>>>> nothing is discarded after module load. Though, I can be wrong. Could
>>>> you point me to the exact place?
>>> If __initdata is not discarded after module load then we should do it.
>>> There is no reason to waste __initdata RAM when the module is loaded.
>> Down at the bottom of sys_init_module we have:
>>
>> 	/* Drop initial reference. */
>> 	module_put(mod);
>> 	unwind_remove_table(mod->unwind_info, 1);
>>
>> 	module_free(mod, mod->module_init);
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 	mod->module_init = NULL;
>> 	mod->init_size = 0;
>> 	mod->init_text_size = 0;
>> 	mutex_unlock(&module_mutex);
>>
>> 	return 0;
>>
>> Which frees the memory for the .init sections.
> 
> Thanks for clarifying this Eric - should have looked myself..

clear :) I was wrong... Thank you for pointing this out.

will you mind against this?

diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 5dd6d90..d136707 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -119,10 +119,14 @@ static inline struct net *maybe_get_net(struct net *net)
 #ifdef CONFIG_NET_NS
 #define __net_init
 #define __net_exit
-#define __net_initdata
 #else
 #define __net_init	__init
 #define __net_exit	__exit_refok
+#endif
+
+#if defined(CONFIG_NET_NS) || defined(MODULE)
+#define __net_initdata
+#else
 #define __net_initdata	__initdata
 #endif
 

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [RFC PATCH] namespaces: document unshare security implications
Next Topic: [patch 1/1][NETNS] fix fib_frontend compilation error
Goto Forum:
  


Current Time: Sun Oct 26 23:19:42 GMT 2025

Total time taken to generate the page: 0.13300 seconds