Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp932479rbd; Fri, 23 Feb 2024 07:59:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXGcz0M+NKfqTWweldpxFWNRxlJinecP/cFoZ/oOV5qpm1TNP3q5vwOF9It93gmjdyYxkcFHQ88p18/zWwgY5+Ljdgz+VufVlspWDSWcA== X-Google-Smtp-Source: AGHT+IE72XMG5RfxARzMqTIDbq6MhbAWYgA/ko3svWIZDSUuHSWWBN+DMNnxx+cuvTv1h/qC5ZbM X-Received: by 2002:a17:906:eb46:b0:a3e:998a:15a2 with SMTP id mc6-20020a170906eb4600b00a3e998a15a2mr147024ejb.54.1708703960740; Fri, 23 Feb 2024 07:59:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708703960; cv=pass; d=google.com; s=arc-20160816; b=HOzxQRCjYLPLx++Oead7pWfHOwGo7NnPIW6necrvwQ5xKuaCblJB0zQI/o6/HVnQ3R U2Ukij0z6ZOhWxC9gYfoFDXysEfd55yjbNKAOWlffVjKnKPi1LqreHL1I9vku/Jt64Ev rP9KH8kdibZqpA7X6qtAG3wg5If9szSFoMhxMqw9hbWUFUG+DREzH2NT3tQ78fEcwkEb i0IaCSh6koOoV/sxDbdqE+A+AYDGql81/cZf10l2vlB4CW+GrlKBiWCnYb0SdS4DlEZl KEnyNgTLYXMSdjaObJ/aV8tYbON1CLyeavtpQc4kdqyiMHYu9CxiymZfBKfGRdUclg+H yvzA== 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:dkim-signature; bh=a4BYLr0MWlji1r8Yd3MAsjyyUgmFtEg5Rxw6JJBPkks=; fh=ROTDl0s9ELwKo5cutDBzeKVm4oVxUeHhHeHvP/bi5yc=; b=WimSKXR2LEEId2puX9pz1teGW9jrZ3fxwjIQgt2n8wCEZTCJ9aPPWz1Hy6cLUR8D7G 8gyPy2G64U+ucxLMfAeQT/OLW1L4Qlpw4/skLLBJZ7u107dcKk2MSMee0aqtjvkVjoOg fjPqjp7hzgi1NjmOTWjcAurrJqmKo9sKZf4RToC50ymQL5n5hfVNw4rk+vbfnqp7DMCF hdWQ3N/4/NW7gEkyM4VccmxlAP3jqfgjvVD6R07AJODYAlF6k4wWK5q8STdKPyNxHWFs ZAGldaUFA7tRhdPrVVBCTQhNDzgcAiMF5efHYMQuUqKBoNsrHczXIQDfe1cyLeJZgXsm 8/yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=YXeyTTYw; arc=pass (i=1 spf=pass spfdomain=layalina.io dkim=pass dkdomain=layalina-io.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-78657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78657-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n4-20020a1709061d0400b00a3d296f46bcsi6371217ejh.806.2024.02.23.07.59.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 07:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=YXeyTTYw; arc=pass (i=1 spf=pass spfdomain=layalina.io dkim=pass dkdomain=layalina-io.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-78657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78657-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 828CA1F26BD5 for ; Fri, 23 Feb 2024 15:59:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D713D83CDB; Fri, 23 Feb 2024 15:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b="YXeyTTYw" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2958C84A29 for ; Fri, 23 Feb 2024 15:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708703899; cv=none; b=QSDTCf8wZ51I0jSL3SNlFraJZtq5s6egVvXSbx4GmkNVxn9k7MnCS6inNMZOTh/kih5bCrjm7gYG/+slVwDZsCj2DHQg/9au64BntFekCKrEx+Jv2mnu0yd6uk1ycrLWRJK/cThszNcMUCPXeTrz1tFecjks2fHPb/uMV5Zp9Co= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708703899; c=relaxed/simple; bh=verFB4RWW2WKHBdwnW5wGBh0OHUpCbgBY9nBGkAThvI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T+/TSi/c8T0BLnowkF+03lsaDEVBRKmIDtYho0vstoibOSkFxuj/YSAV8Ad08jrO0YeW6k/+r89XpR0E1JT5Gdr6z/G6w5FuRtGQJ2g6WwRWx8spaIFLQ+O9cW2rHito+B/UgDkkNRXeCKLtebiYsyaFuJCcyo1gO/p7oFEoxUw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io; spf=pass smtp.mailfrom=layalina.io; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b=YXeyTTYw; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=layalina.io Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a3122b70439so82802966b.3 for ; Fri, 23 Feb 2024 07:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1708703896; x=1709308696; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a4BYLr0MWlji1r8Yd3MAsjyyUgmFtEg5Rxw6JJBPkks=; b=YXeyTTYwcoIAVJ/AeTKf+QibCFXJOubNU7kaqapP71SJhPdcorEKY1IFP0Ddu60xGo hLARODPjotg1kUiHZStUtlRRis+HWyJf5tURVyL1hiij6KoYzDLqLtuYN51k2aD7Fsju DPyVMFmIGcPv3Yns6nLp876sOIFaIPiOeUZ3pjMUhbiPXu9CXcfqDpuFBIYvmdp7G/7N hKsTUNO1Pd+/q+95NV3F9JNo4T4P7B2voPy4woGEzqJfWK37vFMmOMEMdxnMxduMzO4M 8uC68yqumtsB3nmEJq530KwSg80oecc9VmK0ByuegrZM8EHzQPGxwmFF1RoUjvqStonJ 1HNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708703896; x=1709308696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a4BYLr0MWlji1r8Yd3MAsjyyUgmFtEg5Rxw6JJBPkks=; b=qafiseHB60G5Qz2c0C8Qp7Q4ECfABScNa5AENNunxfYPWjbZFuvoN4lLR8DRnCE5iT j4f87IWIbe5jGa3jHQXzeUaLoL8cDbThyphmJxkbdXWYPra8UtVJqtdtR8zFY/X3iWLZ gP5IlD0wjKT+AO7qHITTN/zK6xf0oSiYNAFLrWDSxa2MEktpgUlPDedMKsd3gADgi+Gd JC26wM2G2juRpuNk7yEnw1Y/6DLtm4YeX43pkUz6cOFArw953Ap+yB54UJTtHOn0EYvW VBODDxThJwAdZUqr9JVPW4gXa69mpPyJHQ74t9284lxnddnEWLpMH1Ym5+duZt2ZOPlJ uxEg== X-Gm-Message-State: AOJu0YzSMSMxeBX6KX25ZYxVr1XlKtMfNYp+iJexFPCPGIr85Gx8lUA6 bDLcVxoDvzCe04+N5KAfvjKevB0m4MlpQEG9zybQgtuGHBow353YOkOdPLkb7xk= X-Received: by 2002:a17:906:cec5:b0:a3f:6ff9:6280 with SMTP id si5-20020a170906cec500b00a3f6ff96280mr137907ejb.50.1708703896578; Fri, 23 Feb 2024 07:58:16 -0800 (PST) Received: from airbuntu.. (host109-154-46-208.range109-154.btcentralplus.com. [109.154.46.208]) by smtp.gmail.com with ESMTPSA id rg8-20020a1709076b8800b00a3e28471fa4sm6461293ejc.59.2024.02.23.07.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 07:58:16 -0800 (PST) From: Qais Yousef To: Jens Axboe , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Sudeep Holla , Wei Wang , Jaegeuk Kim , Bart Van Assche , Christoph Hellwig , Qais Yousef Subject: [PATCH v2 1/2] sched: Add a new function to compare if two cpus have the same capacity Date: Fri, 23 Feb 2024 15:57:48 +0000 Message-Id: <20240223155749.2958009-2-qyousef@layalina.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223155749.2958009-1-qyousef@layalina.io> References: <20240223155749.2958009-1-qyousef@layalina.io> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The new helper function is needed to help blk-mq check if it needs to dispatch the softirq on another CPU to match the performance level the IO requester is running at. This is important on HMP systems where not all CPUs have the same compute capacity. Signed-off-by: Qais Yousef --- include/linux/sched/topology.h | 6 ++++++ kernel/sched/core.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index a6e04b4a21d7..11e0e00e0bb9 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -176,6 +176,7 @@ extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], cpumask_var_t *alloc_sched_domains(unsigned int ndoms); void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); +bool cpus_equal_capacity(int this_cpu, int that_cpu); bool cpus_share_cache(int this_cpu, int that_cpu); bool cpus_share_resources(int this_cpu, int that_cpu); @@ -226,6 +227,11 @@ partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], { } +static inline bool cpus_equal_capacity(int this_cpu, int that_cpu) +{ + return true; +} + static inline bool cpus_share_cache(int this_cpu, int that_cpu) { return true; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a76c7095f736..adbaabb23fa1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3953,6 +3953,17 @@ void wake_up_if_idle(int cpu) } } +bool cpus_equal_capacity(int this_cpu, int that_cpu) +{ + if (!sched_asym_cpucap_active()) + return true; + + if (this_cpu == that_cpu) + return true; + + return arch_scale_cpu_capacity(this_cpu) == arch_scale_cpu_capacity(that_cpu); +} + bool cpus_share_cache(int this_cpu, int that_cpu) { if (this_cpu == that_cpu) -- 2.34.1