From owner-svn-src-head@FreeBSD.ORG Mon Jun 14 14:03:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53BA31065670; Mon, 14 Jun 2010 14:03:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2339B8FC19; Mon, 14 Jun 2010 14:03:08 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CB9F746C18; Mon, 14 Jun 2010 10:03:07 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 11F438A03C; Mon, 14 Jun 2010 10:03:07 -0400 (EDT) From: John Baldwin To: mdf@freebsd.org Date: Mon, 14 Jun 2010 10:02:59 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <201006130239.o5D2du3m086332@svn.freebsd.org> <20100614230205.A37830@delplex.bde.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201006141002.59464.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 14 Jun 2010 10:03:07 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Bruce Evans , svn-src-head@freebsd.org, Lawrence Stewart Subject: Re: svn commit: r209119 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 14 Jun 2010 14:03:08 -0000 On Monday 14 June 2010 9:50:10 am mdf@freebsd.org wrote: > > BTW, one reason I liked BSD code more than gnu code is that it didn't > > use so many macros. Macros should only exist when they are not just > > syntactic sugar, like DPCPU_SUM() and unlike CPU_FOREACH(). > > As a style question, I do understand (generally) why too many macros > make the code confusing. However, the *FOREACH macros all fit the > same pattern and having a macro to iterate protects one against > changes in the implementation -- there's a single location to change > if e.g. we want to make CPU_FOREACH use a bitwise operator to > determine the next non-zero bit, rather than testing each > individually. In the case of CPU_FOREACH() there is a very good chance that the implementation details will change when we switch from cpumask_t to cpuset_t, which is part of the reason I added it. I am less of a fan of macros that just wrap TAILQ_FOREACH() (note that there isn't a PCPU_FOREACH() since you can already do this via SLIST_FOREACH() now for example) such as FOREACH_PROC_IN_SYSTEM(). CPU_FOREACH() has additional logic in that it hides the CPU_ABSENT() stuff, so to me it doesn't quite fall in that class. (Some code was using pcpu_find() instead of CPU_ABSENT() to determine absent CPUs as well FWIW.) -- John Baldwin