From patchwork Tue Jun 4 11:20:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 17500 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A27232390D for ; Tue, 4 Jun 2013 11:20:48 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id e15sf79418vbg.4 for ; Tue, 04 Jun 2013 04:20:48 -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 :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=vL2uo0GZ5VPp4e/hC/+LRQtDO+E6qfZ/2uBASGF+wr4=; b=jScREh88Oj6XIjeLcXO8le4gbRqYMLisL4b8GBzSKvgpPDFbC0/zQBNuwCdQprYPuX EsKE7CqAlRj3mRt0uBWyyJMlgRKMTelMXV8nu+bD/EJJ9/kccmsLKg8dMgDLhEw7ldDY qoxkIt238eQ97fOnbBmprwjswKYyjDeBcxHIBxCtpri4j92i8xSYjg18JNtja/IQVkH7 LzWIDbs+iw+kSNauIdD4I86VRHyEhqBILa7NX8UZ9BY5iRbmtu7x1MAt5DbAJjdZsn4U sKxqiA21RElOJZrCXJLxjw+9D1fCjkCMXWH1faP3+b+6XGDBDZgZZi8V2ktmUthuhanc 8Gvg== X-Received: by 10.224.36.66 with SMTP id s2mr16240644qad.6.1370344848308; Tue, 04 Jun 2013 04:20:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.50 with SMTP id f18ls194834qey.20.gmail; Tue, 04 Jun 2013 04:20:48 -0700 (PDT) X-Received: by 10.58.65.101 with SMTP id w5mr18731295ves.16.1370344848033; Tue, 04 Jun 2013 04:20:48 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id ml6si19847297vec.2.2013.06.04.04.20.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Jun 2013 04:20:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hz10so47577vcb.24 for ; Tue, 04 Jun 2013 04:20:47 -0700 (PDT) X-Received: by 10.58.144.231 with SMTP id sp7mr18690339veb.34.1370344847901; Tue, 04 Jun 2013 04:20:47 -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 pb14csp120222vcb; Tue, 4 Jun 2013 04:20:47 -0700 (PDT) X-Received: by 10.68.138.193 with SMTP id qs1mr27475052pbb.95.1370344846681; Tue, 04 Jun 2013 04:20:46 -0700 (PDT) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by mx.google.com with ESMTPS id ym5si42511224pac.224.2013.06.04.04.20.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Jun 2013 04:20:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.177 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.177; Received: by mail-pd0-f177.google.com with SMTP id u10so90560pdi.22 for ; Tue, 04 Jun 2013 04:20:46 -0700 (PDT) X-Received: by 10.66.51.102 with SMTP id j6mr27755864pao.210.1370344846160; Tue, 04 Jun 2013 04:20:46 -0700 (PDT) Received: from localhost ([223.178.131.200]) by mx.google.com with ESMTPSA id eq4sm25291466pad.16.2013.06.04.04.20.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Jun 2013 04:20:45 -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 1/2] sched: Optimize build_sched_domains() for saving first SD node for a cpu Date: Tue, 4 Jun 2013 16:50:18 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e X-Gm-Message-State: ALoCoQmzKKMboa/wXmuf1U2+gjl4oVTFLhgKBwhJKnncxYUX8Bl4UkcehdseOOAf3MlanCivuWcF X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 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: , We are saving first scheduling domain for a cpu in build_sched_domains() by iterating over the nested sd->child list. We don't actually need to do it this way. *per_cpu_ptr(d.sd, i) is guaranteed to be NULL in the beginning as we have called __visit_domain_allocation_hell() which does a memset to zero for struct s_data. So, save pointer to first SD while running the iteration loop over tl's. Signed-off-by: Viresh Kumar --- kernel/sched/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 58453b8..638f6cb 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6533,16 +6533,13 @@ static int build_sched_domains(const struct cpumask *cpu_map, sd = NULL; for (tl = sched_domain_topology; tl->init; tl++) { sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i); + if (!*per_cpu_ptr(d.sd, i)) + *per_cpu_ptr(d.sd, i) = sd; if (tl->flags & SDTL_OVERLAP || sched_feat(FORCE_SD_OVERLAP)) sd->flags |= SD_OVERLAP; if (cpumask_equal(cpu_map, sched_domain_span(sd))) break; } - - while (sd->child) - sd = sd->child; - - *per_cpu_ptr(d.sd, i) = sd; } /* Build the groups for the domains */