Received: by 10.192.165.148 with SMTP id m20csp57666imm; Tue, 24 Apr 2018 17:09:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+6wgWT6JpAq8dqTG731ZNpT0/INvnT0+DCNpOfOJs3pHhUU7P3FVYMWdfB4XeGFiXDmCn6 X-Received: by 2002:a17:902:6542:: with SMTP id d2-v6mr16774544pln.196.1524614991892; Tue, 24 Apr 2018 17:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524614991; cv=none; d=google.com; s=arc-20160816; b=I1WG+NX8b8V7+QfMwZWrCRUEtkIFlDl96VNudYNfKHRfG0uNkE+YkatV/C8CUiicxw vvaO8/259lnq6kiqjqHU/Z0VbpFyFjkbEDbwYrfSqV1UqGUIw3e09dnChqsUMtMu0fUq vjfe0ihj3EsuFY6ptfyG5FBpqP8d+fzBY2COurBejX+RbeOsAalRXEUpNnw6baZONi0u zsD/iuhn0bt3vDpiSZC1JBVs3kEULhhIM0cOdbm7PG83GVo5cV42lw3XConc9tjLJoO0 lxkbewaaOVZmdwcglRTI16ZBXCONVWFMEIX841msSdvPtMIN2D/YGQ4p+gc1DbCN63yB ikig== 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=Hx1YEIJ3P8oVbSahHgJ9NyMs7EuvRJLg6PzaZVFJRWg=; b=Q4vfHo0ugaXDn0c5AvKlBMBfzLTelTks8q6XPu3UXfKxhM1HNdVWICDJsU0cOlgouo Dx7MT0elvFoHDOr35mJ8BunAmWIJF/RjM0wjcFZiEf5zMu2J8aQVcT7pe+l4rAfbqL31 U1xs6s8ViclDSuglUtCXscR0j2fZWtdqcvs1gs/EI4p00/SnQl6Mt3Azxjy56vLs7MAP FjpRv+aWmu+IVDQ5Ge7CfDhnnGBNHPbX08LdDWXt3z5KP0LEe8IK7EjTRPwt0Ws1d0JF zGx6wRbb/UHpKwqkECNVgbsIehydTQ8BYqw+i2rGXn8uLDRVQYgfBZhpd/fE3bldVSEc NUbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=BM/aoWj8; 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 j63si12187277pgc.474.2018.04.24.17.09.35; Tue, 24 Apr 2018 17:09:51 -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=BM/aoWj8; 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 S1750943AbeDYAIR (ORCPT + 99 others); Tue, 24 Apr 2018 20:08:17 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:43684 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750766AbeDYAIQ (ORCPT ); Tue, 24 Apr 2018 20:08:16 -0400 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 w3P06arT116197; Wed, 25 Apr 2018 00:07:38 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=Hx1YEIJ3P8oVbSahHgJ9NyMs7EuvRJLg6PzaZVFJRWg=; b=BM/aoWj8z10VlvJeNBBjOUIDjJkDPMBZySPTC6mPNluitMG8Ddfkh4lZzIL01JLOZBc6 0MXMYSS9FUf8qnwMOIU3sUIWhOUU7YmGANXdcrVx187ohnDEnJ7i9m3vTku3AEKiZdik Z3D3PZJ330iQmlh+KsIgBaeIfJ7RqPJduzKD7QpxYCQyiOOjOhTDhAM+4jzDD8CDOIV4 ufqLvd8sRYw6IqF7b4WIVLJMTh+BE4/PFpkxAX/tq7pBNgJCaD89mNn9QExje83h393l TkjM52NR/Q0kI2zsVmUxop3gLv8fJNBGDd+0f0kR6YwltUN0jJZZHxl3o4Tx1BWbkJ4G QQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2hfw9accyb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Apr 2018 00:07:38 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3P07bnp027239 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Apr 2018 00:07:37 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3P07ahp015248; Wed, 25 Apr 2018 00:07:36 GMT Received: from [10.132.91.87] (/10.132.91.87) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 24 Apr 2018 17:07:36 -0700 Subject: Re: [PATCH 3/3] sched: limit cpu search and rotate search window for scalability 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-4-subhra.mazumdar@oracle.com> <20180424125349.GU4082@hirez.programming.kicks-ass.net> From: Subhra Mazumdar Message-ID: Date: Tue, 24 Apr 2018 17:10:34 -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: <20180424125349.GU4082@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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804240226 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/24/2018 05:53 AM, Peter Zijlstra wrote: > On Mon, Apr 23, 2018 at 05:41:16PM -0700, subhra mazumdar wrote: >> Lower the lower limit of idle cpu search in select_idle_cpu() and also put >> an upper limit. This helps in scalability of the search by restricting the >> search window. >> @@ -6297,15 +6297,24 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t >> >> if (sched_feat(SIS_PROP)) { >> u64 span_avg = sd->span_weight * avg_idle; >> - if (span_avg > 4*avg_cost) >> + if (span_avg > 2*avg_cost) { >> nr = div_u64(span_avg, avg_cost); >> - else >> - nr = 4; >> + if (nr > 4) >> + nr = 4; >> + } else { >> + nr = 2; >> + } >> } > Why do you need to put a max on? Why isn't the proportional thing > working as is? (is the average no good because of big variance or what) Firstly the choosing of 512 seems arbitrary. Secondly the logic here is that the enqueuing cpu should search up to time it can get work itself. Why is that the optimal amount to search? > > Again, why do you need to lower the min; what's wrong with 4? > > The reason I picked 4 is that many laptops have 4 CPUs and desktops > really want to avoid queueing if at all possible. To find the optimum upper and lower limit I varied them over many combinations. 4 and 2 gave the best results across most benchmarks.