From patchwork Mon Jun 10 10:57:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 17717 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2CC992397B for ; Mon, 10 Jun 2013 11:00:19 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id f12sf872324vbg.6 for ; Mon, 10 Jun 2013 04:00:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=TGEkDUGcsHcylJrRFhyYVUmMPK4G/qqBalrFlG/+3ag=; b=gDx7dw1NmhErnRMUbhYbAxrFvZdeq1FgwJGpqux7Z0MfPpSyigMAXZPmd72rPqF51M ywKVRrv8LmJtKy+B1gXHffty22fzdv7VTvfkzp2r+xS6vjEGLOGw+Eo3A/OJh3V8legA mjPgeWnL7dfSbIPsfhaOaYvY6/9zaIRUfBHNz6NBHxHDF1lFxgqMIIynpQmPrha/I8li VQUoUcUtZxkhxrsBZjQhXYgYTRfBvG3b8xFHGuWaJSRIkXXGqbLjPOo/P7WEU3W12Rkx emaZpRiYjxuU4f6vLFRDxRovzLpAMjWIFkuHq+N+TzyY5pM4d/Ft6DLGMD8+XcKR0TEh INMQ== X-Received: by 10.236.92.194 with SMTP id j42mr5823271yhf.38.1370862018454; Mon, 10 Jun 2013 04:00:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.107 with SMTP id t11ls592564qeu.4.gmail; Mon, 10 Jun 2013 04:00:18 -0700 (PDT) X-Received: by 10.220.73.199 with SMTP id r7mr5141048vcj.67.1370862018251; Mon, 10 Jun 2013 04:00:18 -0700 (PDT) Received: from mail-ve0-x235.google.com (mail-ve0-x235.google.com [2607:f8b0:400c:c01::235]) by mx.google.com with ESMTPS id i5si4622107vcn.86.2013.06.10.04.00.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 04:00:18 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::235; Received: by mail-ve0-f181.google.com with SMTP id db10so4558961veb.26 for ; Mon, 10 Jun 2013 04:00:18 -0700 (PDT) X-Received: by 10.220.246.8 with SMTP id lw8mr5184974vcb.8.1370862018145; Mon, 10 Jun 2013 04:00:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp63434vcb; Mon, 10 Jun 2013 04:00:17 -0700 (PDT) X-Received: by 10.68.14.6 with SMTP id l6mr9444944pbc.202.1370862017209; Mon, 10 Jun 2013 04:00:17 -0700 (PDT) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id ez5si1459863pab.338.2013.06.10.04.00.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 04:00:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.178 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id w11so2849498pde.9 for ; Mon, 10 Jun 2013 04:00:16 -0700 (PDT) X-Received: by 10.66.251.39 with SMTP id zh7mr13465712pac.62.1370862016831; Mon, 10 Jun 2013 04:00:16 -0700 (PDT) Received: from localhost ([223.228.11.221]) by mx.google.com with ESMTPSA id ov2sm10060231pbc.34.2013.06.10.04.00.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Jun 2013 04:00:16 -0700 (PDT) From: Viresh Kumar To: mingo@redhat.com, peterz@infradead.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, linux-kernel@vger.kernel.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, arvind.chauhan@arm.com, Viresh Kumar Subject: [PATCH 3/3] sched: Create for_each_sd_topology() Date: Mon, 10 Jun 2013 16:27:20 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQm19hP+8yBokMZBIf0QqTpoUSTctDzCDxysTLu/+N8rpvxllAzn1cUeUai2WGGQ7tUGwX0j X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , For loop for traversing sched_domain_topology was used at multiple placed in core.c. This patch removes code redundancy by creating for_each_sd_topology(). Signed-off-by: Viresh Kumar --- kernel/sched/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a12113d..e585e10 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5552,6 +5552,9 @@ static struct sched_domain_topology_level default_topology[] = { static struct sched_domain_topology_level *sched_domain_topology = default_topology; +#define for_each_sd_topology(tl) \ + for (tl = sched_domain_topology; tl->init; tl++) + #ifdef CONFIG_NUMA static int sched_domains_numa_levels; @@ -5849,7 +5852,7 @@ static int __sdt_alloc(const struct cpumask *cpu_map) struct sched_domain_topology_level *tl; int j; - for (tl = sched_domain_topology; tl->init; tl++) { + for_each_sd_topology(tl) { struct sd_data *sdd = &tl->data; sdd->sd = alloc_percpu(struct sched_domain *); @@ -5902,7 +5905,7 @@ static void __sdt_free(const struct cpumask *cpu_map) struct sched_domain_topology_level *tl; int j; - for (tl = sched_domain_topology; tl->init; tl++) { + for_each_sd_topology(tl) { struct sd_data *sdd = &tl->data; for_each_cpu(j, cpu_map) { @@ -5970,7 +5973,7 @@ static int build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_topology_level *tl; sd = NULL; - for (tl = sched_domain_topology; tl->init; tl++) { + for_each_sd_topology(tl) { sd = build_sched_domain(tl, cpu_map, attr, sd, i); if (tl == sched_domain_topology) *per_cpu_ptr(d.sd, i) = sd;