Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755143AbZDXPdZ (ORCPT ); Fri, 24 Apr 2009 11:33:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750799AbZDXPdM (ORCPT ); Fri, 24 Apr 2009 11:33:12 -0400 Received: from stinky.trash.net ([213.144.137.162]:47734 "EHLO stinky.trash.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753931AbZDXPdK (ORCPT ); Fri, 24 Apr 2009 11:33:10 -0400 Message-ID: <49F1DBAC.8090101@trash.net> Date: Fri, 24 Apr 2009 17:33:00 +0200 From: Patrick McHardy User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Eric Dumazet CC: Stephen Hemminger , Linus Torvalds , Ingo Molnar , Paul Mackerras , paulmck@linux.vnet.ibm.com, Evgeniy Polyakov , David Miller , jeff.chua.linux@gmail.com, laijs@cn.fujitsu.com, jengelh@medozas.de, r000n@r000n.net, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, benh@kernel.crashing.org, mathieu.desnoyers@polymtl.ca Subject: Re: [PATCH] netfilter: use per-CPU recursive lock {XIV} References: <20090418094001.GA2369@ioremap.net> <20090418141455.GA7082@linux.vnet.ibm.com> <20090420103414.1b4c490f@nehalam> <49ECBE0A.7010303@cosmosbay.com> <18924.59347.375292.102385@cargo.ozlabs.ibm.com> <20090420215827.GK6822@linux.vnet.ibm.com> <18924.64032.103954.171918@cargo.ozlabs.ibm.com> <20090420160121.268a8226@nehalam> <20090421111541.228e977a@nehalam> <20090421193924.GA24404@elte.hu> <20090421143927.52d7d89d@nehalam> <20090423210938.1501507b@nehalam> <49F146FF.5050200@cosmosbay.com> In-Reply-To: <49F146FF.5050200@cosmosbay.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1790 Lines: 52 Eric Dumazet wrote: > Stephen Hemminger a ?crit : >> In days of old in 2.6.29, netfilter did locketh using a >> lock of the reader kind when doing its table business, and do >> a writer when with pen in hand like a overworked accountant >> did replace the tables. This sucketh and caused the single >> lock to fly back and forth like a poor errant boy. >> >> But then netfilter was blessed with RCU and the performance >> was divine, but alas there were those that suffered for >> trying to replace their many rules one at a time. >> >> So now RCU must be vanquished from the scene, and better >> chastity belts be placed upon this valuable asset most dear. >> The locks that were but one are now replaced by one per suitor. >> >> The repair was made after much discussion involving >> Eric the wise, and Linus the foul. With flowers springing >> up amid the thorns some peace has finally prevailed and >> all is soothed. This patch and purple prose was penned by >> in honor of "Talk like Shakespeare" day. Hehe. >> static int __init xt_init(void) >> { >> - int i, rv; >> + unsigned int i; >> + int rv; >> + static struct lock_class_key xt_lock_key[NR_CPUS]; > > Could we avoid this [NR_CPUS] thing ? > >> + >> + for_each_possible_cpu(i) { >> + rwlock_t *lock = &per_cpu(xt_info_locks, i); >> + >> + rwlock_init(lock); >> + lockdep_set_class(lock, xt_lock_key+i); >> + } > > > Did you tried : > > static DECLARE_PER_CPU(struct lock_class_key, xt_locks_key); Either way is fine with me, I'll wait for Stephen to state his opinion. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/