Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2122555lqe; Tue, 9 Apr 2024 10:04:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXVuU7I3nU0cA7slWo1Eu+PAmmVYuyQsSNnO825KzPTYfBbDQ4l7lnZsnrDELc7kkK9K+cDuW/Kckc7QujZwTJKbcYsodm8Dpv0Ay7DWw== X-Google-Smtp-Source: AGHT+IFtBl6gsKaimM34fceA5cZWQu1/Sh1adZfnTZYRXe+lAYJ29TH9fU6OEjtKXlHb1OTFmcEj X-Received: by 2002:a05:6a20:12c6:b0:1a7:74c3:a926 with SMTP id v6-20020a056a2012c600b001a774c3a926mr388092pzg.16.1712682298095; Tue, 09 Apr 2024 10:04:58 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k12-20020a63d10c000000b005d4a1e64c7asi9226085pgg.332.2024.04.09.10.04.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 10:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=B51Ub3Qy; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-137314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137314-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 800FCB2457C for ; Tue, 9 Apr 2024 16:25:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3008313E3E4; Tue, 9 Apr 2024 16:25:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="B51Ub3Qy" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 EED4A137C2A for ; Tue, 9 Apr 2024 16:25:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712679916; cv=none; b=WHyvqSPMrBP/m04oSa/GAHrO2RENdT69bD8ZDFzwOv0rS3DveZinV3YdfCelfRZtiXXnQ9qAj2GCvqBMJthRUWm556Jd8niF2/W48EhOZbZarkutW2WktqDs/bpDHv7uSGUnhZDtuHzRAid5/HrQq6G5+NOaRIU84Mk/TW6X928= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712679916; c=relaxed/simple; bh=+cjrGu90UubJL76esXMipBZVAl1+63up9ZPbsgzMTl8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hScpEnYHMqlBXjL+gb0bnQ/ykwH4boMAKyS5oi/QrauprhHPuQNtpgj3264YkfIZHPzQFzFrdqIKtAfg//C+5XCrh+UNM7PBN5O2/zum50iOz7lXEGMOA1kKa1qGk0GOHCYxNbejbB0OYg/vXuYGWG6ye2YkJuL6VhQIvrAMp9U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=B51Ub3Qy; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712679915; x=1744215915; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+cjrGu90UubJL76esXMipBZVAl1+63up9ZPbsgzMTl8=; b=B51Ub3QyiZN0LCTyIe0mJi3kMBos1UeXjaoEianA3sRqX2yRwiqQggZi n7LF3bEsNyTwDKULbzlmBtdOUQJ1VbsLExxFCx3XO2Pv+GS29BhK9CmKO CKKdSrMfxCrV4JD+PQyLls4a4D5yBPDAscopnj7+weTT65NlneupvP0KX 9Cjr2x/zeONMes+q8vM16TJB+6ozlVeAqbjFHkp3srBTR948Kt9tVVQpn a+DoDDYjx6FTsUIOpiIYcGGaTssbyiaWl00OFjpRI1iwK13MPyE3kzD5f rqxao3YQPTwpFdVZ4brGIfM1eaqDmuoO/nvglPeDxDyBFxNHcBJi/AfYz A==; X-CSE-ConnectionGUID: iktY9IiZTnCtwSUlOZRoGw== X-CSE-MsgGUID: 7rjC0sP8S4+wPkglQCtTjQ== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="18610065" X-IronPort-AV: E=Sophos;i="6.07,189,1708416000"; d="scan'208";a="18610065" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 09:25:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="915404275" X-IronPort-AV: E=Sophos;i="6.07,189,1708416000"; d="scan'208";a="915404275" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 09:25:10 -0700 Received: from andy by smile with local (Exim 4.97) (envelope-from ) id 1ruEHT-00000002r9y-0iDB; Tue, 09 Apr 2024 19:25:07 +0300 Date: Tue, 9 Apr 2024 19:25:06 +0300 From: Andy Shevchenko To: Kyle Meyer Cc: linux-kernel@vger.kernel.org, yury.norov@gmail.com, linux@rasmusvillemoes.dk, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, russ.anderson@hpe.com, dimitri.sivanich@hpe.com, steve.wahl@hpe.com Subject: Re: [PATCH 2/2 RESEND] sched/topology: Optimize topology_span_sane() Message-ID: References: <20240409155250.3660517-1-kyle.meyer@hpe.com> <20240409155250.3660517-3-kyle.meyer@hpe.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240409155250.3660517-3-kyle.meyer@hpe.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Apr 09, 2024 at 10:52:50AM -0500, Kyle Meyer wrote: > Optimize topology_span_sane() by removing duplicate comparisons. > > The total number of comparisons is reduced from N * (N - 1) to > N * (N - 1) / 2 (per non-NUMA scheduling domain level). .. > - for_each_cpu(i, cpu_map) { > - if (i == cpu) > - continue; > + for_each_cpu_from(i, cpu_map) { Hmm... I'm not familiar with the for_each_cpu*(), but from the above it seems only a single comparison? Or i.o.w. can i ever repeat the value? And what about i < cpu cases? -- With Best Regards, Andy Shevchenko