Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2322813lqo; Mon, 13 May 2024 15:02:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6slO6lSvruJn7lloAivJLUfjUUxWBGGd6wva8KJXTyOq2EvBoazCObD+8tczg6ArnhG1ZtfgiQDH40sNAH1eduBobW+ExIdRLpzao/Q== X-Google-Smtp-Source: AGHT+IHF7yrB/BU8HMwZuLUz0NHqsu8OfViW857flWAof9P4GhYh7qOBd2nEKvRMgBij1SAYmfPL X-Received: by 2002:a05:6a00:2190:b0:6f4:d07a:e7f0 with SMTP id d2e1a72fcca58-6f4e0347e21mr10480637b3a.27.1715637742116; Mon, 13 May 2024 15:02:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715637742; cv=pass; d=google.com; s=arc-20160816; b=O2nxRFz9oKDr+SDMqEjAAEG2LDj37Js/kMkvI24EJUWGBwkvIimGCMIiE8qaFq5MrY tP8fChx4AnpQow23pyt08gcsuqq+2LLfp4j97RphHZ1gYEibWtkWuGGjfuvfLjgunF1n Vad5KZ+tmNSLFWp+BuMM75yLh+QAQVQIyChkP8fp8f32FteTRMMOvnF0/qFN208a23SH vr+IQZov4iOb1Ac5HPngJWOATZVGusmlqjxZ8TemIkP6Yr+/ivvKj2BdPd0BqneeuvfQ M9oAx9m8Wz2ufHoPnSm/THvuiq5NACTjSWkwxWE/YVC3Ls3ZjH4Fv5FAUVIWyxEtZCRx yRjA== 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:to:from:dkim-signature; bh=NZpiVbm0k8/V4I8fmDlOntjijimOcwopvoeWS8JbgE0=; fh=DiJxzIldUN1xrGF1IfjVuTcNPnBRmEBFP29oLFYpxNc=; b=eMRiTyD9YTYs8kce8JnCzG12E7qb9n/arX5GVLoEh4nGfDfFl6L0XOXz1ocl+xswib AhN4rY3IfL6CGXsi9n7SkfRIbJCduU2W3N2Yj9hwU/BFTATH8ylPOhXQ6sE4njo0a8T6 WcRsXJUAv+RjtjTNBL+2ZadKI99j0jp+rpUXyQh5eljNZPmf30f6pScagxh3QjOB9p4g /Y4h/dpgIC0viUatuv9oLYpIwAjVQAM2KqqWlCsbMdnEu53tiHMMEZG8Q+3Ufw1PQ/kg 6y38c45XbHiItc/hInRPe4RGCkGRNtY3uF0bGsN6dfe5xarBiMXQEwrOVnA7n1P9NoET MfJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PUtoSZLA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178126-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4efdb45bdsi6012525b3a.365.2024.05.13.15.02.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 15:02:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178126-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PUtoSZLA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178126-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E83152833E5 for ; Mon, 13 May 2024 22:02:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2BC584E06; Mon, 13 May 2024 22:01:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PUtoSZLA" Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (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 BF5BF84A56; Mon, 13 May 2024 22:01:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715637715; cv=none; b=ffxFYYRdlpfE0CjzvoI7IBPvkzW427d5a/XFZHMVcDuzZbdvux+XjbFIfehNVq0ffMSol7Dc6nsn3XMh07zKTkBGv6kgvba/p/E4yfBbVuLPHVh9av1/TVHNhnCqkkk/cLZzbQLMy8hxsIbyzOxaj5vjB4DlDjU3RzNEZn0UXYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715637715; c=relaxed/simple; bh=ZhkiaUtTBV4sSkcaAXAYusiHCrJIwiwNrjA2rNBwfck=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jdItl3mV8Jts6fAlUhe5xO4VUPCcxyomwgp4p1wJKSzOK0RD9/1IdKNz5bohSC6NUDvj3LeeGhVkh0ddCEO4RkdnYloTbSzMXZDvQUtaHplwciEuOJBEcqrv8kSVY5sdNi2i6U9ftYDBMgt6/0wQfMVrGkiK4KzV7xzj3mkdeHE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PUtoSZLA; arc=none smtp.client-ip=209.85.128.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-61804067da0so48870907b3.0; Mon, 13 May 2024 15:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715637713; x=1716242513; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=NZpiVbm0k8/V4I8fmDlOntjijimOcwopvoeWS8JbgE0=; b=PUtoSZLAgciRxD9erhbo4ARDe4deox+nvpOv99jbeSnQa7q2yvRMjnJNn9Vbb9pV70 o/A1i8UqAAkQFruOZBejjabefv2GrhWRDqppeyu6bj6JS4B7/4OkTRG+/ieMYaMWAGxa x0c2G3X+dq8OUGYmcR5Qu3v+MPReytHD8zHPqKr567+VqgSeegDCPoCZITzCIMZ3sQXH hKR72b7oUJ/nP0+ARl3iDaxKVyFn7SCs4gLIZm4/7rTqipDb1nbp6nuIEGei+8Le2rUI i81ByL63mA/kIw34IJpNwR/GxA7Rf7HATEln6uXi4QLMeMYmOrwzc/UHvuw6UB/2o+kz BZ0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715637713; x=1716242513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NZpiVbm0k8/V4I8fmDlOntjijimOcwopvoeWS8JbgE0=; b=Vuq/3s7koz43LxW03J9k3WkFLMQzHc3FcOTI/55l5SXeUzhMTf7npnwhpKWj0E9A9E ybgjRaSYc0B6aLJ6s+PFYvCMMp9PFk/nlkKbyfJZJfdNsyZOa35RMQzRUtBoMix8OV9D c20Jx1RdBfMEtdE//Wnrk/oRy+KzFB4r7Vpqij3Mc/+FKCgkEen1jnyS0OeKXgXX/Un6 uVvW+6iplcVau4tCD6S0bGQkOFfyfHAWimRUv+CbM8gV5wGyRQlZQYVfsWxf8DyN/tfz yLYPlsaQW0CoxqlfWhdTK+aMFR++W8z1KU8jKpSbHPDBF5FeuwJGDhxLk8pV9Mz8ax1K qRyQ== X-Forwarded-Encrypted: i=1; AJvYcCXRkyMBe83KfswZAQvEFMi3XdWA75QK8BoBazyWgvIxaGeefGw0X8m9CC5qHKFwcFnvFL1UmI92FHHp0J6Rzj9ZbfA+c7ppuw== X-Gm-Message-State: AOJu0YwTvJk8zuDIQGimlrzIqdufxEW7d6kC1xGpDzbZk027JGDSB4Hr 6oiFT+wYFkGbnGurcSueiFxGTG14f2ErzReXpLDaEOTlwqjDJd+2useDOQ== X-Received: by 2002:a0d:d652:0:b0:61b:11d5:a675 with SMTP id 00721157ae682-622afff6ad2mr107541507b3.32.1715637712670; Mon, 13 May 2024 15:01:52 -0700 (PDT) Received: from localhost ([2601:344:8301:57f0:8acf:1c06:973:d499]) by smtp.gmail.com with ESMTPSA id 00721157ae682-622cd7e0117sm11902287b3.44.2024.05.13.15.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 15:01:52 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Paul E. McKenney" , "Rafael J. Wysocki" , Anna-Maria Behnsen , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Frederic Weisbecker , Imran Khan , Ingo Molnar , Johannes Weiner , Juri Lelli , Leonardo Bras , Mel Gorman , Peter Zijlstra , Rik van Riel , Steven Rostedt , Tejun Heo , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Waiman Long , Yury Norov , Zefan Li , cgroups@vger.kernel.org Subject: [PATCH 2/6] sched/topology: optimize topology_span_sane() Date: Mon, 13 May 2024 15:01:42 -0700 Message-Id: <20240513220146.1461457-3-yury.norov@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240513220146.1461457-1-yury.norov@gmail.com> References: <20240513220146.1461457-1-yury.norov@gmail.com> 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 function may call cpumask_equal with tl->mask(cpu) == tl->mask(i), even though cpu != i. In such case, cpumask_equal() would always return true, and we can proceed to the next CPU immediately. Signed-off-by: Yury Norov --- kernel/sched/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 99ea5986038c..eb9eb17b0efa 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -2360,7 +2360,7 @@ static bool topology_span_sane(struct sched_domain_topology_level *tl, * breaks the linking done for an earlier span. */ for_each_cpu(i, cpu_map) { - if (i == cpu) + if (i == cpu || tl->mask(cpu) == tl->mask(i)) continue; /* * We should 'and' all those masks with 'cpu_map' to exactly -- 2.40.1