From owner-svn-src-all@FreeBSD.ORG Sun Mar 10 03:54:30 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8B9D1E3A; Sun, 10 Mar 2013 03:54:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id 2C4C8A32; Sun, 10 Mar 2013 03:54:29 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r2A3sJog027553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 10 Mar 2013 14:54:21 +1100 Date: Sun, 10 Mar 2013 14:54:19 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Davide Italiano Subject: Re: svn commit: r248113 - head/sys/kern In-Reply-To: <201303092003.r29K3BPc089195@svn.freebsd.org> Message-ID: <20130310143353.G1358@besplex.bde.org> References: <201303092003.r29K3BPc089195@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=bNdOu4CZ c=1 sm=1 a=_LPLbtEpN8oA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=M4roAWbnUW4A:10 a=D8whqW29NONGbe-aHQ8A:9 a=CjuIK1q_8ugA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Mar 2013 03:54:30 -0000 On Sat, 9 Mar 2013, Davide Italiano wrote: > Log: > Fixup r248032: > Change size requested to malloc(9) now that callwheel buckets are > callout_list and not callout_tailq anymore. This change was already > there but it seems it got lost after code churn in r248032. > > Reported by: alc, kib This still has the bad style that helped cause the bug. > Modified: head/sys/kern/kern_timeout.c > ============================================================================== > --- head/sys/kern/kern_timeout.c Sat Mar 9 20:01:35 2013 (r248112) > +++ head/sys/kern/kern_timeout.c Sat Mar 9 20:03:10 2013 (r248113) > @@ -294,7 +294,7 @@ callout_cpu_init(struct callout_cpu *cc) > > mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); > SLIST_INIT(&cc->cc_callfree); > - cc->cc_callwheel = malloc(sizeof(struct callout_tailq) * callwheelsize, > + cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, > M_CALLOUT, M_WAITOK); > for (i = 0; i < callwheelsize; i++) > LIST_INIT(&cc->cc_callwheel[i]); > sizeof(*cc->cc_callwheel) is less verbose and works irrespective of the type of *cc->cc_callwheel. In kern, not quite half the malloc()'s have this style bug. Also, at least in kern: - most style bugs in the form of using the MALLOC() obfuscation have been fixed - most style bugs in the form of casting the result of malloc() to support C++ have been fixed. The remaining ones are usually accompanied by the style bug of putting a space after the cast. Bruce