From owner-svn-src-head@FreeBSD.ORG Fri Apr 11 19:17:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B1B4DE; Fri, 11 Apr 2014 19:17:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB9B912C7; Fri, 11 Apr 2014 19:17:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3BJHjSL001187; Fri, 11 Apr 2014 19:17:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3BJHjMS001186; Fri, 11 Apr 2014 19:17:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201404111917.s3BJHjMS001186@svn.freebsd.org> From: John Baldwin Date: Fri, 11 Apr 2014 19:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264351 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Apr 2014 19:17:46 -0000 Author: jhb Date: Fri Apr 11 19:17:45 2014 New Revision: 264351 URL: http://svnweb.freebsd.org/changeset/base/264351 Log: The tw_pcbrele() function does not need the global timewait lock. Submitted by: Julien Charbon Suggested by: glebius Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Fri Apr 11 18:40:29 2014 (r264350) +++ head/sys/netinet/tcp_timewait.c Fri Apr 11 19:17:45 2014 (r264351) @@ -133,23 +133,18 @@ tw_pcbref(struct tcptw *tw) } /* - * Drop a refcount on an tw elevated using tw_pcbref(). Return - * the tw lock released. + * Drop a refcount on an tw elevated using tw_pcbref(). */ static int tw_pcbrele(struct tcptw *tw) { - TW_WLOCK_ASSERT(V_tw_lock); KASSERT(tw->tw_refcount > 0, ("%s: refcount 0", __func__)); - if (!refcount_release(&tw->tw_refcount)) { - TW_WUNLOCK(V_tw_lock); + if (!refcount_release(&tw->tw_refcount)) return (0); - } uma_zfree(V_tcptw_zone, tw); - TW_WUNLOCK(V_tw_lock); return (1); } @@ -682,13 +677,10 @@ tcp_tw_2msl_stop(struct tcptw *tw, int r TAILQ_REMOVE(&V_twq_2msl, tw, tw_2msl); crfree(tw->tw_cred); tw->tw_cred = NULL; + TW_WUNLOCK(V_tw_lock); - if (!reuse) { + if (!reuse) tw_pcbrele(tw); - return; - } - - TW_WUNLOCK(V_tw_lock); } struct tcptw * @@ -730,7 +722,6 @@ tcp_tw_2msl_scan(void) /* Close timewait state */ if (INP_INFO_TRY_WLOCK(&V_tcbinfo)) { - TW_WLOCK(V_tw_lock); if (tw_pcbrele(tw)) { INP_INFO_WUNLOCK(&V_tcbinfo); continue; @@ -744,7 +735,6 @@ tcp_tw_2msl_scan(void) INP_INFO_WUNLOCK(&V_tcbinfo); } else { /* INP_INFO lock is busy, continue later */ - TW_WLOCK(V_tw_lock); tw_pcbrele(tw); break; }