OpenVZ Forum


Home » Mailing lists » Devel » [PATCH net-2.6.25 3/3] Uninline the inet_twsk_put function
Re: [PATCH net-2.6.25 3/3] Uninline the inet_twsk_put function [message #25663 is a reply to message #25265] Thu, 20 December 2007 18:32 Go to previous message
Ingo Oeser is currently offline  Ingo Oeser
Messages: 4
Registered: January 2007
Junior Member
Pavel Emelyanov schrieb:
> This one is not that big, but is widely used: saves 1200 bytes 
> from net/ipv4/built-in.o
> +void inet_twsk_put(struct inet_timewait_sock *tw)
> +{
> +	if (atomic_dec_and_test(&tw->tw_refcnt)) {
> +		struct module *owner = tw->tw_prot->owner;
> +		twsk_destructor((struct sock *)tw);
> +#ifdef SOCK_REFCNT_DEBUG
> +		printk(KERN_DEBUG "%s timewait_sock %p released\n",
> +		       tw->tw_prot->name, tw);
> +#endif
> +		kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
> +		module_put(owner);
> +	}
> +}
> +EXPORT_SYMBOL_GPL(inet_twsk_put);

More correct fix seems to be conversion to kref.

Just create out of line inet_twsk_release() containing
sth. similiar to the code inside these braces and modify 
inet_twsk_put() to sth. like this:

static inline inet_twsk_put(struct inet_timewait_sock *tw)
{
	kref_put(&tw->kref, inet_twsk_release);
}

David, can you see any reason (e.g. some crazy lock stuff) NOT to do this?


Best Regards

Ingo Oeser
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [RFC] [PATCH -mm] oom_kill: remove uid==0 checks
Next Topic: Catching the console
Goto Forum:
  


Current Time: Tue Jul 22 18:22:10 GMT 2025

Total time taken to generate the page: 0.10556 seconds