Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2870519rdh; Wed, 27 Sep 2023 15:49:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEceuxi5St63J0wwEZNwSZUuSwDv4DSNxISab/Ok1jI1ExfZDTW0ryLbNvM9qnEJlc8AnRc X-Received: by 2002:a5d:4b08:0:b0:31a:ea86:cbb8 with SMTP id v8-20020a5d4b08000000b0031aea86cbb8mr3077917wrq.2.1695854970589; Wed, 27 Sep 2023 15:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695854970; cv=none; d=google.com; s=arc-20160816; b=Jf8pIRKRO1Zo+amg5HqaVdhthy5p4oIiRCOuUk6XvKQofpt6A2hUpWSy47snDaZz1g KSsdUy6K/WgFOcLZe6B/F6z6IbunWiTnp4RMh8/2/vCnwPP+BZaF3ftFWACOh9vid0fU /7IYKruk05i/Dux8xz/aVoUBPYp5wqvMow+Joe7EFNdKYoObBbdYoTFLX2p9rlq0JVfq ihOzZlj/ScJkfF+BxJYKFXeW75/0ZjW2Bln2gIi5DqljRRA/eeQhZo51dw87sdeWNeJZ /+dwnXl1x1KwO29padTof78Prn+0l59+8sBoaMgZAUEH9NHAS3ql94i+t6HkYxpDo4QG ScjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=EGLGrhuLy8HhgnNUsdtjzejE+2Cri0zmCgyKrAKBVBk=; fh=ftij8aZyYWcEY99kO4R5Yj41pSNFIYi4Zsf56wDIUkc=; b=fmOCSmQ7eKjyRuQA77fuG2WiIL9FdMtFoiH4hBQgM2uUPCzUps8VEyRI0C6x9QU0hn DPh7D1s3AAx9rykUkh5HM0ELZVCIep19S8U99Y06//jVye+xnESbp+s9SC3nl+sgA5RA t5zg+4vCEe0VBLuzcsG30DeIgaIbDpMp1RZedUtjRH7EuSjLDXO5M9FoNnIwEaJobmAD v7x3oSlURn6hs9ZSQw5CDl2pDej7QA1udj3/097sq/+i96YE6/Wrk8VnEBlFztlynz+t Vi5ll4pN5wH1DVWEk94PW0Oibe82lUAWNwAhtW8t37xCjvwrTtquO7RoI5JJ9KUnAtRN zIpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=xb2fUbJM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id kg28-20020a17090776fc00b00993150ec3c7si14214805ejc.966.2023.09.27.15.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:49:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=xb2fUbJM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5B3B7804747B; Wed, 27 Sep 2023 09:12:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbjI0QMD (ORCPT + 99 others); Wed, 27 Sep 2023 12:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbjI0QMD (ORCPT ); Wed, 27 Sep 2023 12:12:03 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A491BE4 for ; Wed, 27 Sep 2023 09:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1695831118; bh=fgc9IdmUaNy4X1jVRlgY4R36W4JC1ydNBrzr1sOs/ZE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=xb2fUbJMvbXaNDx8YLGRV7YvzWrZvqDn43Mjqc2SsT28q/YgS/2nP2/NXqnw4pa9O i32kJRNTj3dj1/dU29xI0EF6zB223r3azREs5nhr2Zghd+fbXMAxUXuWSKDRXkOAzC CPWszQFSDMyz9F3I3cUM1n1lTnKRJcWMV3hdYTmUInDPPUN58DP6cJ+Z0wVkCydyTV q++AwQiSBRIkn++JyAR01HEo7AP/NbGFCH5dRlCArkHvwXVoUJne+P4+5qnft8GK/m 4U+tNx6aYP9V/zckGWw8KRBQok2L1GfPtaQPJdAdtWL4blmGEYDg9fQNWAFu4EfPSQ HDUKGIpfJjW2A== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4RwhSs6TTDz1QnK; Wed, 27 Sep 2023 12:11:57 -0400 (EDT) Message-ID: <5a7d9084-a716-5641-6319-ae8c918ac3f9@efficios.com> Date: Wed, 27 Sep 2023 12:11:33 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH 2/2] sched/fair: skip the cache hot CPU in select_idle_cpu() Content-Language: en-US To: Chen Yu , Peter Zijlstra , Ingo Molnar , Vincent Guittot , Juri Lelli Cc: Tim Chen , Aaron Lu , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , K Prateek Nayak , "Gautham R . Shenoy" , linux-kernel@vger.kernel.org, Chen Yu References: <4f2131940d43060eda55847a2affc8042179b4ee.1695704179.git.yu.c.chen@intel.com> From: Mathieu Desnoyers In-Reply-To: <4f2131940d43060eda55847a2affc8042179b4ee.1695704179.git.yu.c.chen@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 09:12:19 -0700 (PDT) On 9/26/23 06:11, Chen Yu wrote: > Problem statement: > When task p is woken up, the scheduler leverages select_idle_sibling() > to find an idle CPU for it. p's previous CPU is usually a preference > because it can improve cache locality. However in many cases, the > previous CPU has already been taken by other wakees, thus p has to > find another idle CPU. > > Proposal: > Inspired by Mathieu's idea[1], introduce the SIS_CACHE. It considers > the sleep time of the task for better task placement. Based on the > task's short sleeping history, keep p's previous CPU idle for a short > while. Later when p is woken up, it can choose its previous CPU in > select_idle_sibling(). When p's previous CPU is reserved, another wakee > is not allowed to choose this CPU in select_idle_idle(). The reservation > period is set to the task's average short sleep time, AKA, se->sis_rsv_avg. > > This does not break the work conservation of the scheduler, because > wakee will still try its best to find an idle CPU. The difference is that > different idle CPUs might have different priorities. > > Prateek pointed out that, with SIS_CACHE enabled, if all idle CPUs are > cache-hot, select_idle_cpu() might have to choose a non-idle target CPU, > which brings task stacking. Mitigate this by returning the first cache-hot > idle CPU if no cache-cold CPU is found. I've tried your patches on my reference hackbench workload: ./hackbench -g 32 -f 20 --threads --pipe -l 480000 -s 100 Unfortunately they don't appear to help for that specific load. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com