Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6534768yba; Tue, 14 May 2019 09:07:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJnycg2SPfqkJn0tc+f2D7R/9Kv5BLsfhIa9f2ITfGhsF8ZX/C2Cy/88so2M3Z0JTjivqw X-Received: by 2002:a63:4006:: with SMTP id n6mr39247801pga.424.1557850053319; Tue, 14 May 2019 09:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557850053; cv=none; d=google.com; s=arc-20160816; b=X5u3TxboZhGHCsyhe2LbXyMgDeWIbi1dUzQIK2tJWdZHDdI+gKx9FxEoP2YjKmkWu1 1jRXTIZsM3+zbEf9fukWnZUSTr1FeIsUlGNC7H/6urAiWLRlZnfWPbUf+Tk02YUjb10B jq5TRq58gjwAjj3/c+cIZz5wrUL8HdZ3Sc+gm359HpnJaN+W/JJHAvo+NsOe/4cqoyB5 6jdIplDDCOrZyruBVJM1w2SPqkbk4ZsJG0RSwhGplAyd/B9ziOsRNhbxc1Ej67NP/nEa JoDYTL2NAO+04QyzU3kw7m+Zz6ARNiuwQT2gzupJLZP7Xa41Ji/TsztLuP3boVkkeeRb egHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=LKX2pJCZMM1fM5+jEyMtPXBt1Ui1VdtBDPvhsBNL6VM=; b=IjIoi4t9lNRjnUWJA6Vt8ops1szJ/JOnmQ0Kt0pOCsf6rLYYDcrLXEHibw1qQlWdzk qggnVbu56qb5fN8x6k0emH399vhgaDkirY1k/p0kMfvXWbAF7tw1lMcVNsnmuMz6HvPv 52PK4ZSbqBH1qztAoI8LSEotV3UsSIfBlZ/T6/+eyMd5Dl81RMgBpfrVYzfymwnr8eXI 7eGQ3zauVHHQsMSXMhk8W84qFwSK1UrRhqJH65v1VIul6T83rnHj4RAPgS4p0Jzed9Vm /k86cHHet5ZJxwc1HQzQoLAZlIH8vScbItmB5lstL3zHOgKI/PV37mLf+3yrPdxUpZxM 7urw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="FVH/1fBV"; 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 j12si21871884pgg.188.2019.05.14.09.07.17; Tue, 14 May 2019 09:07:33 -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-2018-07-02 header.b="FVH/1fBV"; 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 S1726325AbfENQDx (ORCPT + 99 others); Tue, 14 May 2019 12:03:53 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:35382 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfENQDw (ORCPT ); Tue, 14 May 2019 12:03:52 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4EFrh4T075818; Tue, 14 May 2019 16:03:28 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-2018-07-02; bh=LKX2pJCZMM1fM5+jEyMtPXBt1Ui1VdtBDPvhsBNL6VM=; b=FVH/1fBVq/9bb+b70RdubSY71Oyx9B4cg5tSjA/xyWD1lO4HlKakAfyzhJG+ogf1EUso zyPY6j9o64v1FPRW5c8/st1MX63dHPSPq7nTHRNsxl1ug/vTW8kbay97eCLhZMVK35iu ckHACP/VX5R0Fct1yr7wy9sZXjZ0QP/c0V9mCBIbjFrQ2mU9IXwxU1cufpGH73v7hqLd oeSW/hjJX8SksaBF9Sri2LOLxKy6izpfVXxbq61m0qvtJ0TMPWESyUCT9piVoKmoEreb IgIGrweG0ngmlbXXXNd3Th8cGvXvHwtr6224ljvbNExUSaq18EOcpsr+DLxmBkX/fGI9 wg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2sdkwdqc1x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 May 2019 16:03:28 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4EG3LuL022208; Tue, 14 May 2019 16:03:27 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2se0tw84k3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 May 2019 16:03:27 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x4EG3NOK000843; Tue, 14 May 2019 16:03:25 GMT Received: from [172.10.12.21] (/24.113.124.115) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 May 2019 09:03:23 -0700 Subject: Re: [RFC V2 2/2] sched/fair: Fallback to sched-idle CPU if idle CPU isn't found To: Peter Zijlstra , Viresh Kumar , Subhra Mazumdar Cc: songliubraving@fb.com, Ingo Molnar , Vincent Guittot , tkjos@google.com, Daniel Lezcano , quentin.perret@linaro.org, chris.redpath@arm.com, Dietmar.Eggemann@arm.com, linux-kernel@vger.kernel.org References: <59b37c56b8fcb834f7d3234e776eaeff74ad117f.1556182965.git.viresh.kumar@linaro.org> <20190510072125.GG2623@hirez.programming.kicks-ass.net> <20190513093418.altqhlhu4zsu75t4@vireshk-i7> <20190513113518.GQ2623@hirez.programming.kicks-ass.net> From: Steven Sistare Organization: Oracle Corporation Message-ID: <05ffe5f4-4324-2977-e46e-155e1aef57fa@oracle.com> Date: Tue, 14 May 2019 12:03:21 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190513113518.GQ2623@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9256 signatures=668686 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-1810050000 definitions=main-1905140113 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9256 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905140112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/13/2019 7:35 AM, Peter Zijlstra wrote: > On Mon, May 13, 2019 at 03:04:18PM +0530, Viresh Kumar wrote: >> On 10-05-19, 09:21, Peter Zijlstra wrote: > >>> I don't hate his per se; but the whole select_idle_sibling() thing is >>> something that needs looking at. >>> >>> There was the task stealing thing from Steve that looked interesting and >>> that would render your apporach unfeasible. >> >> I am surely missing something as I don't see how that patchset will >> make this patchset perform badly, than what it already does. > > Nah; I just misremembered. I know Oracle has a patch set poking at > select_idle_siblings() _somewhere_ (as do I), and I just found the wrong > one. > > Basically everybody is complaining select_idle_sibling() is too > expensive for checking the entire LLC domain, except for FB (and thus > likely some other workloads too) that depend on it to kill their tail > latency. > > But I suppose we could still do this, even if we scan only a subset of > the LLC, just keep track of the last !idle CPU running only SCHED_IDLE > tasks and pick that if you do not (in your limited scan) find a better > candidate. Subhra posted a patch that incrementally searches for an idle CPU in the LLC, remembering the last CPU examined, and searching a fixed number of CPUs from there. That technique is compatible with the one that Viresh suggests; the incremental search would stop if a SCHED_IDLE cpu was found. I also fiddled with select_idle_sibling, maintaining a per-LLC bitmap of idle CPUs, updated with atomic operations. Performance was basically unchanged for the workloads I tested, and I inserted timers around the idle search showing it was a very small fraction of time both before and after my changes. That led me to ignore the push side and optimize the pull side with task stealing. I would be very interested in hearing from folks that have workloads that demonstrate that select_idle_sibling is too expensive. - Steve