Received: by 10.223.176.5 with SMTP id f5csp33688wra; Tue, 6 Feb 2018 16:35:54 -0800 (PST) X-Google-Smtp-Source: AH8x225m8thiHLhTq6FdeVGL7YabROrff4TzEXPOPRxsyyL6zCWOShK6jvOmNl6MG0E98f6M9Ntd X-Received: by 2002:a17:902:71cb:: with SMTP id t11-v6mr1487416plm.229.1517963754690; Tue, 06 Feb 2018 16:35:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517963754; cv=none; d=google.com; s=arc-20160816; b=EEYPM5sB0N5zM8lXdfKU3am2C7RJSK1hhklutcSPiSFcTqtr7hSgQDlbrZAyFB7use MQouoN76rvGDbe77epS67YQ96pKRhnXpc7KqDBbgKid3xPDZrc9dkeFuSqq3ynjv2fTp VmBaEaxPCTJ1kVuYmX24nLyBcim3FsoB4XWJi2zMJnOTW+DJj7g1LaoNIHXmX3eP2bCB nNEmrIq5r7j46TEw1afovytTby4t+1R6NPewTVWAbuwgn2PhUpYiDfLFVN3Pe9oKFH8c edWPJmZIXMxvSKa6TbnyJsnIOpH0vR1R8MefUxPi35XEHRCsSsKjZHPVkrV/o+q8dvau pDMw== 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=g/IAiAS+pXRYpMKwLOjhTWqv5GZpISuyFt2vOr1KoXc=; b=0wo4Jr+sAgyvk3LSS9WVhTugGp4aPNcgtcxnLzmcZrVDfEYKlJVdjf37YdMAjICiei hJPPZwGO82ka0dZ2Ns3GGp3d3qHywhTM9v5JBBmabE2ewqgWMsco+YtkFL/DVgNIuvog BqcuKAojeOeCv3eTIyn4yr7AVrWEBAPauzg4waTn+Fnq39b3DlZpnEUnGWPH+WCScMaT NUjMJn9ErVzMmLIBuKzDxmw6eD9bAfukqNt2KylObDT64VFsWvhQb04pf2NnnNj4c0gB dCvoRUd+/9bpleZxI8bL/noQRWScFn629LN9YbimnX7/Nxca1mOBld2opoiTf6MZLXlj Fm+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=g2RajFGS; 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 c11-v6si154276pls.365.2018.02.06.16.35.40; Tue, 06 Feb 2018 16:35:54 -0800 (PST) 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=g2RajFGS; 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 S1754238AbeBGAes (ORCPT + 99 others); Tue, 6 Feb 2018 19:34:48 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:57532 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754183AbeBGAer (ORCPT ); Tue, 6 Feb 2018 19:34:47 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w170WuZP182255; Wed, 7 Feb 2018 00:34:22 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=g/IAiAS+pXRYpMKwLOjhTWqv5GZpISuyFt2vOr1KoXc=; b=g2RajFGSkRd2YLXh69pjvKozsK8Je+974rbmCNpovlM+MM34qvC12uzMAyzkqqb0nQ+w EhO3VZwY7rHA5BGCPKJnHtAnSWiCc8/6ggBvirooX95lVMTOao7U8SIHUw6TOhyBQfvu wvqfglnDju98PQOtcFBaOUGGIuOCPlYLuqo6eBhaofWEsm3ft2p0BKOktULOfDX/V1fs bTAkesFomRstgzH3q3Y/108v9eI2E/YqDBduZJQBJABvM01xPwy+fqjLFoY055hxknXL 0CiQ3b58Iny6+HE7k2joMMYOb2A9l1dO38/9/11pTYqUrnB1zKQY5d8L8PLr0zkmhNuh Ig== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2fyn4u8cdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 07 Feb 2018 00:34:22 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w170TLl5002177 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 7 Feb 2018 00:29:21 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w170TKQe017950; Wed, 7 Feb 2018 00:29:20 GMT Received: from [10.132.91.87] (/10.132.91.87) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 06 Feb 2018 16:29:20 -0800 Subject: Re: [RESEND RFC PATCH V3] sched: Improve scalability of select_idle_sibling using SMT balance To: Peter Zijlstra Cc: Steven Sistare , linux-kernel@vger.kernel.org, mingo@redhat.com, dhaval.giani@oracle.com References: <20180129233102.19018-1-subhra.mazumdar@oracle.com> <20180201123335.GV2249@hirez.programming.kicks-ass.net> <911d42cf-54c7-4776-c13e-7c11f8ebfd31@oracle.com> <20180202171708.GN2269@hirez.programming.kicks-ass.net> <93db4b69-5ec6-732f-558e-5e64d9ba0cf9@oracle.com> <20180205121947.GW2269@hirez.programming.kicks-ass.net> <930364e4-bbfe-8c8f-d095-0dd4256a5104@oracle.com> <20180206091239.GA2269@hirez.programming.kicks-ass.net> From: Subhra Mazumdar Message-ID: <97500234-ebbb-4404-d4de-ab10d3ec79e1@oracle.com> Date: Tue, 6 Feb 2018 16:30:03 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180206091239.GA2269@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=8797 signatures=668663 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802070005 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/06/2018 01:12 AM, Peter Zijlstra wrote: > On Mon, Feb 05, 2018 at 02:09:11PM -0800, Subhra Mazumdar wrote: >> The pseudo random is also used for choosing a random core to compare with, >> how will transposing achieve that? > Not entirely sure what your point is. Current code doesn't compare to > just _one_ other core, and I don't think we'd ever want to do that. > > So currently select_idle_core() will, if there is an idle core, iterate > the whole thing trying to find it. If it fails, it clears the > 'have_idle_core' state. > > select_idle_cpu, which we'll fall back to, will limit the scanning based > on the average idle time. > > > The crucial point however, is that concurrent wakeups will not, on > average, do the same iteration because of the target offset. I meant the SMT balance patch. That does comparison with only one other random core and takes the decision in O(1). Any potential scan of all cores or cpus is O(n) and doesn't scale and will only get worse in future. That applies to both select_idle_core() and select_idle_cpu(). Is there any reason this randomized approach is not acceptable even if benchmarks show improvement? Are there other benchmarks I should try? Also your suggestion to keep the SMT utilization but still do a traversal of cores in select_idle_core() while remembering the least loaded core will still have the problem of potentially traversing all cores. I can compare this with a core level only SMT balancing, is that useful to decide? I will also test on SPARC machines with higher degree of SMT. You had also mentioned to do it for only SMT >2, not sure I understand why as even for SMT=2 (intel) benchmarks show improvement. This clearly shows the scalability problem. Thanks, Subhra