Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Apr 2014 23:29:20 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>, Julien Charbon <jcharbon@verisign.com>
Cc:        adrian@FreeBSD.org, src-committers@freebsd.org, svn-src-all@freebsd.org, rrs@FreeBSD.org, rwatson@FreeBSD.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r264321 - head/sys/netinet
Message-ID:  <20140410192920.GT44326@FreeBSD.org>
In-Reply-To: <201404101815.s3AIFZx3065541@svn.freebsd.org>
References:  <201404101815.s3AIFZx3065541@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140410192920.GT44326>