Received: by 10.192.165.148 with SMTP id m20csp5192946imm; Tue, 24 Apr 2018 15:39:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx49kCUxdGGhsN/Ipsru4iqraQyO9sQwL0ZordB4ehtO4/XypXqBGAVEMl9O1CWt3YcbGb/Em X-Received: by 2002:a17:902:8c91:: with SMTP id t17-v6mr7817391plo.182.1524609563516; Tue, 24 Apr 2018 15:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524609563; cv=none; d=google.com; s=arc-20160816; b=au8R6VfR+aTq+IoR397FN5waP9nH/TX10YtB0OY1446XzZXa5z1i0+cLlwso1VaHWx p15QY1OGZX47cnl/K48pcegR1DEAySg7Db76abIV1DHrbGBAJ6ss2+KoPqK2n9eYMtGO NS3g7kXLKSRzlkBAT03KjEoGvy8B/c8a4jGjqqvVlddweIc3KK4EKoraAylq5x/eqkai G+AmBQz7LMFtusvntfPL2UR55D/68+k65b4zzn1RNFs9909PFoy3EXL9cdvA9WSFBFI9 ZmYlLjZSvII+0I0hZWVPXj+YnhMe9xmh7EKytdIdDNr8ENmIfIX/jxspbstuCs2ViLTr jLgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=kDMNjT5UaIpxKO4uTN7DZO2HcyKKNHty+FVdfaUr+8E=; b=zW4jys+f7rPjVrNmijoYc0jz7sk02Vfm8jyhbEGOwMoJwpIzZcuil3xcuAiJ8QAeTV COOA+vMLj5l43Mld/CiVp4qasQe3j4lFBwCq2gKHibeK3fB1rKM8aM3wIUo6uk0ZhJ3B sRfz9pK8lgdGnQYVZpRewV81C2YeFR3wdrr+VvB3btl7fcMnAPLNzqLee4PwUzt0yohR WakEiB/OgaMNoXyWZko30r5JaRwl1PQeKc9UcQIMOTi942W0bjPPERZXTxYcdDjU9Ghe DeSwwjraKLeon+KXAMviD8aD1h3Nd+eCcCdemwqafmH4LyE99bYyHJ9zM002obsrevJN RSpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=k2Kne9F5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f30-v6si2962770plj.600.2018.04.24.15.39.04; Tue, 24 Apr 2018 15:39:23 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=k2Kne9F5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751698AbeDXWhS (ORCPT + 99 others); Tue, 24 Apr 2018 18:37:18 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:45880 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbeDXWhO (ORCPT ); Tue, 24 Apr 2018 18:37:14 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3OMah81174399; Tue, 24 Apr 2018 22:36:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=kDMNjT5UaIpxKO4uTN7DZO2HcyKKNHty+FVdfaUr+8E=; b=k2Kne9F5SwUrxRKZvyMa32J354QpHX/Hz5XOa4R1eraPPNz/FH86q3K56SOY6DnZ/0xx JXMPInJZ53vmleWAWXmFiSJeiz15TJxHtb6NUG8T8D3hZ8/n45NnXsLLccozzAcNVrNz tk6TFo1TK8HoDecBFf/skqz8AcJU59mUuxsfN5Cp7jBQzlrqXdVw2/NdApM1CmRBrNAe dHoLiuLgJTZP5Wf3BjsV26j6TEsLhG/RcRXYK9EcAbHngADFoxZgVz22ZU3Gvpw5p2dy vOQBfy0LM1EtguEL/tG+l5EA3g7pjNJrV7UxFinT1RMVS2LDPmcjP889Tkwlu0PErlHq AA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2hfvrbvage-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Apr 2018 22:36:43 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3OMahtm026961 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Apr 2018 22:36:43 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w3OMagqJ031601; Tue, 24 Apr 2018 22:36:42 GMT Received: from [10.132.91.87] (/10.132.91.87) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 24 Apr 2018 15:36:42 -0700 Subject: Re: [PATCH 2/3] sched: introduce per-cpu var next_cpu to track search limit To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, daniel.lezcano@linaro.org, steven.sistare@oracle.com, dhaval.giani@oracle.com, rohit.k.jain@oracle.com References: <20180424004116.28151-1-subhra.mazumdar@oracle.com> <20180424004116.28151-3-subhra.mazumdar@oracle.com> <20180424124712.GR4082@hirez.programming.kicks-ass.net> From: Subhra Mazumdar Message-ID: <991291cf-68e8-24ef-f3a2-ee8a45f58b6a@oracle.com> Date: Tue, 24 Apr 2018 15:39:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180424124712.GR4082@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8873 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=981 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804240212 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/24/2018 05:47 AM, Peter Zijlstra wrote: > On Mon, Apr 23, 2018 at 05:41:15PM -0700, subhra mazumdar wrote: >> @@ -17,6 +17,7 @@ >> #include >> >> DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); >> +DEFINE_PER_CPU_SHARED_ALIGNED(int, next_cpu); >> >> #if defined(CONFIG_SCHED_DEBUG) && defined(HAVE_JUMP_LABEL) >> /* >> @@ -6018,6 +6019,7 @@ void __init sched_init(void) >> struct rq *rq; >> >> rq = cpu_rq(i); >> + per_cpu(next_cpu, i) = -1; > If you leave it uninitialized it'll be 0, and we can avoid that extra > branch in the next patch, no? 0 can be a valid cpu id. I wanted to distinguish the first time. The branch predictor will be fully trained so will not have any cost.