Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1082733rdb; Mon, 19 Feb 2024 03:56:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQ2xvnzLmLEfW7s+o51fObDuLvOfPzV0A1Q36GRGbkwdouR8sWbaD5ZLISplzKvZXIln+H5WsvEwIOHh4UcJ9UvL4fX/uVJK28lWSCwA== X-Google-Smtp-Source: AGHT+IG/SGG/D5LQkqrk06XMBatVzJRn3Xn31VB/A2CALEvG1EWS4n7mLLWpsCOzyveZntFUtkN9 X-Received: by 2002:aa7:ca4a:0:b0:564:4ac2:c0a2 with SMTP id j10-20020aa7ca4a000000b005644ac2c0a2mr2493656edt.15.1708343766773; Mon, 19 Feb 2024 03:56:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708343766; cv=pass; d=google.com; s=arc-20160816; b=fTQPugo/jEZFqK0OqLfiT6Oe0WdDAoE7Pr8xkj0iErPWn0gVDFpnscreb0veoOvLuC OuebeEbXJHfy5C+X7zoCnfJtVqYVwzvQMlEyYhhwSovopHg/TBZviJ9LhHllTLLyAuRA SCHwwBMRKz9OaDlBH5M/B50uFVmLAH4rTLpazKyWOr1l8QO/LfmDYwTGPCjs0IrdsDgD L6B3XdPlfnWiLUTQPhrBuFDAkOOcO94vPi/9nC1YD6tO0+k0+4eEf5CWl04aoh8c08wz 64x3CjJZVe7cmZVXwnuegYtssXhv6WOHf2y5F+Hc9Dw/KrkbVGV8/aQ5S0MjjUyHq49y yaaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=eNGXJD8c0hMC8AlDLPaaEHebfo7AlKnYpCs2hXeYFQU=; fh=Vq8rRaqXeKTbAz58sHd92/JtXvsI2eiydamCyKzKlCM=; b=DWsdkRQunW1XBHKiyvZCsL6Mr0MJXvLkiwDKr9WU9fCtK/zAwU19ULWJOt2NQ+4PFq UI4jU++tM3C7AJRLn7R76lHnl2kRA7TCLCwznoindkA/pIy605IUD2ULOF3gXqr7eIWv SxZGHDkSESViWaMR9DMFpguiuvLZSXCafhji3K/RwOHvmoxryRHfJbMfUNMYrERbOvnp bZs0AHORSuHdB4tw9V1XUZwn1Z/gwrLB8zM/8kKd1hriha0CTPl1SpEEECn0pGr7cjBG OYI5asFEncV/R3uTHvZiooj7WsUWv56j+Q7Oq+8FENpYJHNQaF2CiE92UHwKPqGVycIf gXSg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-71257-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71257-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t21-20020aa7d715000000b00563f1559c6asi2415481edq.158.2024.02.19.03.56.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 03:56:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71257-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-71257-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71257-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 861611F217B5 for ; Mon, 19 Feb 2024 11:56:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 683482CCDF; Mon, 19 Feb 2024 11:56:01 +0000 (UTC) Received: from mail115-95.sinamail.sina.com.cn (mail115-95.sinamail.sina.com.cn [218.30.115.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D223A22F00 for ; Mon, 19 Feb 2024 11:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.95 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343760; cv=none; b=MZrCcxweVZ9M1Ivjlpv67DhJ5BNO6zqK94+m1GvR9yP3L1qP4/I4ycr7fM0txaXr5245xTvgYh9AYGtdWSTT+c2TGHuv84qbJIKsbhAmu+4QYkE/nweCIviF58Q4472sT8eCotMEZbtsEXug0fZ2eAenbsGxYzWNRDl40f1SHnw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343760; c=relaxed/simple; bh=y0UIklNnKZM5nijJtKykqYX+P5z9/aUxva0HnXWRgDQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Vibpy5ldbmN4HRrwQ6CJKfynxxVFRBfdH0MyO5DFTEN504GbcEVSYF70ShG1v8Cs3DMexovymhaIsJ/QhI3u4CP1+eEYbsRgBKIZC62VOMBvuMVyB7dMHs8GZ898McvuQe92JqhCQZnfGif0ONOrhnuRsRxls/+6g3hACKyr30g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.95 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.118.64.82]) by sina.com (172.16.235.24) with ESMTP id 65D3407F00006019; Mon, 19 Feb 2024 19:50:28 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 95218145089571 X-SMAIL-UIID: 22E409DE58DC4221B8DB985F39DC424D-20240219-195028-1 From: Hillf Danton To: Chen Yu Cc: Peter Zijlstra , Mathieu Desnoyers , Vincent Guittot , Mel Gorman , K Prateek Nayak , Chen Yu , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] sched/fair: do not scribble cache-hot CPU in select_idle_cpu() Date: Mon, 19 Feb 2024 19:50:14 +0800 Message-Id: <20240219115014.1333-1-hdanton@sina.com> In-Reply-To: <35e612eb2851693a52f7ed1ff9be5bc24011136f.1700548379.git.yu.c.chen@intel.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, 21 Nov 2023 15:40:14 +0800 Chen Yu > 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: > Introduce the SIS_CACHE. It considers the sleep time of the task for > better task placement. Based on the task's short sleeping history, > tag p's previous CPU as cache-hot. Later when p is woken up, it can > choose its previous CPU in select_idle_sibling(). When other task is > woken up, skip this cache-hot idle CPU when possible. > > SIS_CACHE still prefers to choose an idle CPU during task wakeup, > the idea is to optimize the idle CPU scan sequence. Could you specify why the currently selected cpu fails to work in the scenario described above? /* * If the previous CPU is cache affine and idle, don't be stupid: */ if (prev != target && cpus_share_cache(prev, target) && (available_idle_cpu(prev) || sched_idle_cpu(prev)) && asym_fits_cpu(task_util, util_min, util_max, prev)) return prev;