From owner-freebsd-current@FreeBSD.ORG Thu Apr 29 05:28:59 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1BBA916A4CE; Thu, 29 Apr 2004 05:28:59 -0700 (PDT) Received: from sev.net.ua (sev.net.ua [212.86.233.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4593D43D3F; Thu, 29 Apr 2004 05:28:57 -0700 (PDT) (envelope-from shadow@psoft.net) Received: from berloga.shadowland ([213.227.237.65]) by sev.net.ua (8.12.10/8.12.9) with ESMTP id i3TCShv0093475; Thu, 29 Apr 2004 15:28:44 +0300 (EEST) (envelope-from shadow@psoft.net) Received: from berloga.shadowland (berloga.shadowland [127.0.0.1]) by berloga.shadowland (8.12.10/8.12.10) with ESMTP id i3TCShZ9017047; Thu, 29 Apr 2004 15:28:43 +0300 Received: (from root@localhost) by berloga.shadowland (8.12.10/8.12.10/Submit) id i3TCScGt017045; Thu, 29 Apr 2004 15:28:38 +0300 From: Alex Lyashkov To: Bruce Evans In-Reply-To: <20040429214942.T11397@gamplex.bde.org> References: <200404281541.08851.jhb@FreeBSD.org> <20040429214942.T11397@gamplex.bde.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: quoted-printable Organization: PSoft Message-Id: <1083241717.25424.7.camel@berloga.shadowland> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-1) Date: Thu, 29 Apr 2004 15:28:38 +0300 cc: "freebsd-current@freebsd.org" cc: Julian Elischer Subject: Re: code cleanup X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2004 12:28:59 -0000 =F7 =FE=D4=D7, 29.04.2004, =D7 15:04, Bruce Evans =D0=C9=DB=C5=D4: > On Wed, 28 Apr 2004, John Baldwin wrote: >=20 > > On Wednesday 28 April 2004 02:26 pm, Julian Elischer wrote: > > > On Wed, 28 Apr 2004, John Baldwin wrote: > > > > On Wednesday 28 April 2004 02:26 am, Alex Lyashkov wrote: > > > > > Hi All > > > > > > > > > > how i see many points at kernel work with allproc list direct, bu= t > > > > > proc.h introduce macros FOREACH_PROC_IN_SYSTEM. > > > > > This patch clean this places. > > > > > > > > I'd actually rather see the FOREACH_PROC macro removed, I don't thi= nk > > > > hiding the fact that it's a TAILQ is all that useful. >=20 > I'd rather it had never been. >=20 > > > it makes it possible (well, easier) to do: > > > > > > FOREACH_PROC_IN_SYSTEM(p) { > > > FOREACH_KSEGROUP_IN_PROC(p, kg) { > > > FOREACH_THREAD_IN_GROUP(kg.td) { > > > something(td, kg); > > > } > > > } > > > } > > > > > > Which is a lot easier to read and understand > > > than the expanded version. You don't kave to remember the linkage > > > pointer's names and you can add debugging to it > > > and check that the correct loks are held etc. > > > (the latter being a major reason I did it). >=20 > This macro seemed more reasonable when it was added because its scope > was limited and I thought it was temporary. >=20 > > Note that the allproc_lock protects the allproc list. W/o the FOREACH_= PROC > > macro, I can grep for 'allproc' in the source tree to find all users to > > verify locking, etc. With the extra macro, I now have to do multiple g= reps. > > When you multiple the effect with several wrapper macros, it now become= s much > > more work to work on locking the lists of structures since you have to = do > > multiple greps to find the places to look at. I think remembering the > > linkages for lists is actually quite important to avoid using the same > > linkage for multiple lists incorrectly. >=20 > Macros are bad for debugging. The above is a sort of high level aspect > of debugging. One low level one is when need to look at the linkages > for the lists. >=20 > Bruce who prevent have special define for debug allproc list (as witness) ?=20 if it`s defined macros add additional checks inside. you can define it only for one c file. --=20 Alex Lyashkov PSoft