From patchwork Mon Mar 17 21:48:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 26412 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45662202FA for ; Mon, 17 Mar 2014 21:49:41 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id b6sf16002024yha.0 for ; Mon, 17 Mar 2014 14:49:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=OiLI6B1iJljiF4uNXP7CE4yLmdFMmfmvJlmyfeZEIK0=; b=ft3Ec8aMe3l3iWHuQSUvOXfo9SCxLPGxPvRqaiRdzXNhrd72n8nJqPpHacrpzNwX4E KQflbxQVMD4LG1gXYi1YZnQ3WVWHWqQozGtnyV62fPBbf8YKooOobD4LhfkwavqbCtpe L9UNOkVh+kr7wIQOu44a4uqsK2GJDveUOjISvesqa5KlsWv8JlyebRaOnVP8+9IJD/xE OVo8tVol6WFUPzZSurrhh0repnmZs4T+BGDx1KNcNnz0kZ/x8Y9hSDteOMSe0lYjHo9h toaq61qtqynMiur4xCDlmg47PNXZf/plz/lBwEAPWA5N+W9S0pl5QeqyLH+N1G4UksS3 GYww== X-Gm-Message-State: ALoCoQk6qJNlW2LwyX/ZbdtqPTBiyqfBohaZ4IoUvutWnSyjkfUfi96S1ExvtBEbKaZBySWVDuC7 X-Received: by 10.58.171.135 with SMTP id au7mr603896vec.22.1395092980985; Mon, 17 Mar 2014 14:49:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.50 with SMTP id l47ls1794311qga.49.gmail; Mon, 17 Mar 2014 14:49:40 -0700 (PDT) X-Received: by 10.220.164.80 with SMTP id d16mr21171224vcy.15.1395092980813; Mon, 17 Mar 2014 14:49:40 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id sh5si2128467vdc.68.2014.03.17.14.49.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Mar 2014 14:49:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so6021717veb.25 for ; Mon, 17 Mar 2014 14:49:40 -0700 (PDT) X-Received: by 10.58.201.5 with SMTP id jw5mr20578846vec.6.1395092980728; Mon, 17 Mar 2014 14:49:40 -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.78.9 with SMTP id i9csp158208vck; Mon, 17 Mar 2014 14:49:40 -0700 (PDT) X-Received: by 10.66.218.234 with SMTP id pj10mr5961914pac.156.1395092979830; Mon, 17 Mar 2014 14:49:39 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xn1si7997949pbc.248.2014.03.17.14.49.39; Mon, 17 Mar 2014 14:49:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391AbaCQVtc (ORCPT + 26 others); Mon, 17 Mar 2014 17:49:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64112 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750706AbaCQVta (ORCPT ); Mon, 17 Mar 2014 17:49:30 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2HLn65G017827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Mar 2014 17:49:06 -0400 Received: from deneb.redhat.com (ovpn-113-45.phx2.redhat.com [10.3.113.45]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s2HLn5Zi025808; Mon, 17 Mar 2014 17:49:05 -0400 From: Mark Salter To: Ingo Molnar , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Mark Salter Subject: [PATCH] sched: use zalloc_cpumask_var for rootdomain cpumasks Date: Mon, 17 Mar 2014 17:48:35 -0400 Message-Id: <1395092915-26526-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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: msalter@redhat.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 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 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: , In kernel/sched/core.c, there is: static int init_rootdomain(struct root_domain *rd) { memset(rd, 0, sizeof(*rd)); if (!alloc_cpumask_var(&rd->span, GFP_KERNEL)) goto out; if (!alloc_cpumask_var(&rd->online, GFP_KERNEL)) goto free_span; if (!alloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL)) goto free_online; if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL)) goto free_dlo_mask; In the CONFIG_CPUMASK_OFFSTACK=y case, there doesn't appear to be anything clearing the cpumasks. I think these should be zalloc_cpumask_var() calls. I noticed this while debugging a memory corruptor in unrelated code which cleared the span cpumask and triggered a BUG in the scheduler. I had turned on CONFIG_PAGE_POISONING and looking at the span cpumask at various points during early boot and saw that the mask was filled with POISON_FREE bytes before the secondary cores started coming up and setting their cpu bits in the mask. Signed-off-by: Mark Salter --- kernel/sched/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f5c6635..9843755 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5355,13 +5355,13 @@ static int init_rootdomain(struct root_domain *rd) { memset(rd, 0, sizeof(*rd)); - if (!alloc_cpumask_var(&rd->span, GFP_KERNEL)) + if (!zalloc_cpumask_var(&rd->span, GFP_KERNEL)) goto out; - if (!alloc_cpumask_var(&rd->online, GFP_KERNEL)) + if (!zalloc_cpumask_var(&rd->online, GFP_KERNEL)) goto free_span; - if (!alloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL)) + if (!zalloc_cpumask_var(&rd->dlo_mask, GFP_KERNEL)) goto free_online; - if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL)) + if (!zalloc_cpumask_var(&rd->rto_mask, GFP_KERNEL)) goto free_dlo_mask; init_dl_bw(&rd->dl_bw);