svn commit: r264321 - head/sys/netinet

Gleb Smirnoff glebius at FreeBSD.org
Thu Apr 10 19:30:13 UTC 2014


  Hi,

  one comment:

On Thu, Apr 10, 2014 at 06:15:35PM +0000, John Baldwin wrote:
J> +/*
J> + * Drop a refcount on an tw elevated using tw_pcbref().  Return
J> + * the tw lock released.
J> + */
J> +static int
J> +tw_pcbrele(struct tcptw *tw)
J> +{
J> +
J> +	TW_WLOCK_ASSERT(V_tw_lock);
J> +	KASSERT(tw->tw_refcount > 0, ("%s: refcount 0", __func__));
J> +
J> +	if (!refcount_release(&tw->tw_refcount)) {
J> +		TW_WUNLOCK(V_tw_lock);
J> +		return (0);
J> +	}
J> +
J> +	uma_zfree(V_tcptw_zone, tw);
J> +	TW_WUNLOCK(V_tw_lock);
J> +	return (1);
J> +}

We can unlock before uma_zfree(), that would reduce contention.

Why do we need the lock in this function at all? We don't manipulate
the TAILQ.

-- 
Totus tuus, Glebius.


More information about the svn-src-all mailing list