From patchwork Wed Apr 30 13:46:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 29425 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC440202FE for ; Wed, 30 Apr 2014 13:47:13 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf9001937obc.9 for ; Wed, 30 Apr 2014 06:47:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=ttWYpI0sOpZqmlZYaupVk9cV1ssVB/qsWwKwNsRFM1A=; b=PYgVUbppJqNP+izuN+tQ96Csz4FVlXCd5TZl3REvJ/T+lmBTmtM4PuSir11fnOItXJ vBGUgjZRtvyHXxanpPm4lAqfMgwFBMMvc4yvl70ixumvx8lCPoUh5zQgAFK0IgLETH3c VKC/oni5pfnStOW8P4Bj17HkJrD32mpNAsuMVWqU1vuWbQMeYjowGpKbDIpseO8GJzaX z+D5/C40Ao0r4icXf/3yGlzBNYK0iImYB/Nhq0t9q3LcKjqzHKjO21w2btTuMOsFwfaZ 1U5RCh/VgU3LBZs+O2wX5veawVngyrSMKeVfeXd09Vr6/Km/xfzXh4IfQlurscd1avqq HhGg== X-Gm-Message-State: ALoCoQkVRCRgvPC8yEe6RYtFqMTW4fGgGHvO7eFdj2v4/vf+Qj1W7m9fVoMeDo8KNhGP4aFwRNtS X-Received: by 10.42.115.129 with SMTP id k1mr2191347icq.25.1398865632735; Wed, 30 Apr 2014 06:47:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.24.42 with SMTP id 39ls565749qgq.26.gmail; Wed, 30 Apr 2014 06:47:12 -0700 (PDT) X-Received: by 10.52.252.43 with SMTP id zp11mr281066vdc.44.1398865632627; Wed, 30 Apr 2014 06:47:12 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id cx8si1561508vec.165.2014.04.30.06.47.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 06:47:12 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ik5so2196925vcb.32 for ; Wed, 30 Apr 2014 06:47:12 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr4031797vec.15.1398865632524; Wed, 30 Apr 2014 06:47:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp280297vcb; Wed, 30 Apr 2014 06:47:09 -0700 (PDT) X-Received: by 10.60.69.71 with SMTP id c7mr908024oeu.82.1398865629227; Wed, 30 Apr 2014 06:47:09 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id eh9si19329380oeb.100.2014.04.30.06.47.08; Wed, 30 Apr 2014 06:47:08 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758995AbaD3Nqx (ORCPT + 28 others); Wed, 30 Apr 2014 09:46:53 -0400 Received: from service87.mimecast.com ([91.220.42.44]:47052 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758939AbaD3Nqv convert rfc822-to-8bit (ORCPT ); Wed, 30 Apr 2014 09:46:51 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 30 Apr 2014 14:46:50 +0100 Received: from [10.1.197.147] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 30 Apr 2014 14:47:03 +0100 Message-ID: <5360FECF.6060301@arm.com> Date: Wed, 30 Apr 2014 14:46:55 +0100 From: Dietmar Eggemann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Peter Zijlstra CC: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups References: <1398865178-12577-1-git-send-email-dietmar.eggemann@arm.com> In-Reply-To: <1398865178-12577-1-git-send-email-dietmar.eggemann@arm.com> X-OriginalArrivalTime: 30 Apr 2014 13:47:03.0758 (UTC) FILETIME=[AB2B8EE0:01CF647A] X-MC-Unique: 114043014465000501 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dietmar.eggemann@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 30/04/14 14:39, Dietmar Eggemann wrote: > From: Dietmar Eggemann > > There is no need to zero struct sched_group member cpumask and struct > sched_group_power member power since both structures are already allocated > as zeroed memory in __sdt_alloc(). > > This patch has been tested with > BUG_ON(!cpumask_empty(sched_group_cpus(sg))); and BUG_ON(sg->sgp->power); > in build_sched_groups() on ARM TC2 and INTEL i5 M520 platform including > CPU hotplug scenarios. > > Signed-off-by: Dietmar Eggemann > --- > kernel/sched/core.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 9cae286824bb..6bc51aebbf1b 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -5807,8 +5807,6 @@ build_sched_groups(struct sched_domain *sd, int cpu) > continue; > > group = get_group(i, sdd, &sg); > - cpumask_clear(sched_group_cpus(sg)); > - sg->sgp->power = 0; > cpumask_setall(sched_group_mask(sg)); > > for_each_cpu(j, span) { > there is also a discrepancy between build_sched_groups() and build_overlap_sched_groups(). The latter one sets power and power_orig to SCHED_POWER_SCALE * cpumask_weight(sg_span) (since c3decf0dfbc95 'sched: Always initialize cpu-power' and 8e8339a3a1069 'sched: Initialize power_orig for overlapping groups'). So we could do the same in build_sched_groups(). IMHO, then the appropriate check 'if (!group->sgp->power_orig)' in sched_domain_debug_one() becomes superfluous. -- Dietmar Patch proposal against tip_sched_core. -- >8 -- Subject: [PATCH] sched: Initialize sg->sgp->power and sg->sgp->power_orig for non-overlapping groups --- kernel/sched/core.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9cae286824bb..ccf9b811ba37 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5206,18 +5206,6 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, break; } - /* - * Even though we initialize ->power to something semi-sane, - * we leave power_orig unset. This allows us to detect if - * domain iteration is still funny without causing /0 traps. - */ - if (!group->sgp->power_orig) { - printk(KERN_CONT "\n"); - printk(KERN_ERR "ERROR: domain->cpu_power not " - "set\n"); - break; - } - if (!cpumask_weight(sched_group_cpus(group))) { printk(KERN_CONT "\n"); printk(KERN_ERR "ERROR: empty group\n"); @@ -5807,8 +5795,6 @@ build_sched_groups(struct sched_domain *sd, int cpu) continue; group = get_group(i, sdd, &sg); - cpumask_clear(sched_group_cpus(sg)); - sg->sgp->power = 0; cpumask_setall(sched_group_mask(sg)); for_each_cpu(j, span) { @@ -5819,6 +5805,9 @@ build_sched_groups(struct sched_domain *sd, int cpu) cpumask_set_cpu(j, sched_group_cpus(sg)); } + sg->sgp->power = SCHED_POWER_SCALE * cpumask_weight(sched_group_cpus(sg)); + sg->sgp->power_orig = sg->sgp->power; + if (!first) first = sg; if (last)