Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261324AbTFFMld (ORCPT ); Fri, 6 Jun 2003 08:41:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261328AbTFFMld (ORCPT ); Fri, 6 Jun 2003 08:41:33 -0400 Received: from e6.ny.us.ibm.com ([32.97.182.106]:58078 "EHLO e6.ny.us.ibm.com") by vger.kernel.org with ESMTP id S261324AbTFFMlc (ORCPT ); Fri, 6 Jun 2003 08:41:32 -0400 Date: Fri, 6 Jun 2003 18:28:07 +0530 From: Dipankar Sarma To: "Perez-Gonzalez, Inaky" Cc: "'lkml (linux-kernel@vger.kernel.org)'" Subject: Re: How to initialize complex per-cpu variables? Message-ID: <20030606125807.GA2561@in.ibm.com> Reply-To: dipankar@in.ibm.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 754 Lines: 27 On Thu, Jun 05, 2003 at 09:35:37PM +0000, Perez-Gonzalez, Inaky wrote: > Now the question is: how do I walk each structure that is > associated to each CPU - I mean, something like: > > struct rtf_h *h; > for_each_cpu (h, rtf_lh) { > rtf_h_init (h); > } One way to do this would be to do - for (i = 0; i < NR_CPUS; i++) { if (cpu_possible(i)) rtf_h_init(&per_cpu(rtf_lh, i)); } However you might want to actually use the CPU notifiers to do this. See rcu_init() in kernel/rcupdate.c. Thanks Dipankar - 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/