Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2931577lqo; Tue, 14 May 2024 14:02:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqvuD4BhEIvDTj8Zr5fci4VhzUmHAmRjtNLmSpmUs/InHMr5+i43IkRJeZMPB2khoQgUKibcNCvXi9JTSb1B/iQUUKWQ+C5mbK4hFQLg== X-Google-Smtp-Source: AGHT+IEO/2PRa2ULlZGX05Pi3n2XiKW8XldkQJ5phPGUpSchHQV04epflV195YcUWYgNwZwVXJk2 X-Received: by 2002:ac2:5b84:0:b0:521:54b5:86a3 with SMTP id 2adb3069b0e04-52210273d59mr8483965e87.64.1715720544487; Tue, 14 May 2024 14:02:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715720544; cv=pass; d=google.com; s=arc-20160816; b=ZBFdsbCkzBs0jh67Z6xqpcBkBLHbFCDerSNJcTZr0ap4uPnvE1eUaLUMuSKh4g9vZ0 ljVqy/JqUj4cYpp7CFXfqC+5iiFM9CDf80WHjaGNotg5T+sQWv4BsDvxNRM3fTyYQDSj xNQxYxppzohX4WwO/dcHOOVHT/m+KYv5g6HDfMual/jct1w57hbhzGWJMFOgxTy4SYKk JjQX/krESiHoXMG3EJC7Rck0qNwUMx/lMvQHL9pTsciP0RkAsXIE96wwVtIR00SqY/Cc eGwyS0BNnKM7esuTiayUPIid55Xj5fNB21sarHOD3XXhFCIHCFGnWBF+bYdPm4rjnmT0 N6QA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:to:dkim-signature :dkim-signature:from; bh=l9IhefwFGHqUFohDsQBE0bSZV5Ni7HPgyBwTX8U3rtw=; fh=SlbWHRj+gLOrlvL53ns/nI+gY3x1SHKz8fepAhc9mLo=; b=JOm15isvN4Qu5DAB+mt1HYn5G7ZoNZHi+QFx3m3qmv/eNpW2je4KOhHwikxQClo5tv DmNR1+Vef/XW0v/huG1CMWggSDvmFiZjPEDgqHS4zVV4pRJIGVbaQUtvB9C03edAS/8z Ht3dVyCZWgXAM57kvgETxjgCnA9u/YEX6E/uVrDTYbHpg0oIDWYyngi0h55KoJbd5Iyc KI7FEz32WVi+b3qXvzomFC45tOwxjUIYZiM8Q9X5QO5GTIepd6HYSz2ywJ2u7P7k5DtE x20sY8FwazdmbhrAj6Z/4NZqtaZTxi+FtGOZEHnpbUnYKFguUhIztvO0V35//yatDgv8 fwgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xTHATAbS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-179166-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179166-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b21b93si641566166b.364.2024.05.14.14.02.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 14:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179166-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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xTHATAbS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-179166-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179166-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 781321F22C61 for ; Tue, 14 May 2024 21:02:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BFF7181333; Tue, 14 May 2024 21:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xTHATAbS"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Dweu8njF" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 D70BE14532B; Tue, 14 May 2024 21:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715720524; cv=none; b=qWHl/p93VmEIEsbV8PcFpPxrk2gK/AylfxuY/O8AgMfXIt6xlpDJI6OA/n5ghM+4awZkEfl2M8wD6vmikGtEkdfUg7nsyb12C/QrPeYGTCRTcx2T0t4qLCFY6vtVQTB0N75wWM5hhZJaWeFjObIJbiDDZDMxqu8Z3guzTlOA7G8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715720524; c=relaxed/simple; bh=oNNSswIyrt13EK8oXKF/p1rfPKlwxsz+mTptoXw8pUk=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=JFlc/z9lCj8L7Zw1+iSDjKAWRR3ntG12PhCNw6TicNApI17HzHywXqFHSLk/d34UA3jM0D12x27Dh7LOdLFXs6+oPcokgbgHgm91YZhPgg1ZLkb06/ksIIoWmhkT2NLtVpyLke64jKhtV/DJCaxlcwwdpyS/LWlCIcQJEWwrhPA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xTHATAbS; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Dweu8njF; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1715720521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=l9IhefwFGHqUFohDsQBE0bSZV5Ni7HPgyBwTX8U3rtw=; b=xTHATAbS2oMlFmU6eR+Gzu1a3vT8mekSwRgnuz1YS3XvVDoHBoIMqULio2ndUn9WP2ICWF gVWExzS0yzfhheDls2sX765jaH+nmuOGwcZYTNnnp17kwzfWEE2fqeGibiRIgTXV6JpaFI qZ+DYt1ekmDlyuCWnSy9huETcMJF0wOQUINTDfiIQ8jjcgZp3wYy4FBAqBdj8WlQF7ROdx zHdakega01kbXTFPcLlSBWEXWpYH1LkZNQIhVcbsUywuIZybaDf0vbaSLR+yPmRTJJ2q2c UxJ6PT7rDT/sDk8G7COrgst9cIjlgOGxjC3DqcsuDbTVvU44Tp1Lp5yGMxAI5Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1715720521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=l9IhefwFGHqUFohDsQBE0bSZV5Ni7HPgyBwTX8U3rtw=; b=Dweu8njFymxpAMKfxaoBwSdUnenIrETZ5nUXq2uSyUt7JIeu5epMEk1O9qFSQ30RdiM9m/ EMLFVyv2o679WFCg== To: Yury Norov , 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 , Valentin Schneider , Vincent Guittot , Waiman Long , Yury Norov , Zefan Li , cgroups@vger.kernel.org Subject: Re: [PATCH 3/6] driver core: cpu: optimize print_cpus_isolated() In-Reply-To: <20240513220146.1461457-4-yury.norov@gmail.com> References: <20240513220146.1461457-1-yury.norov@gmail.com> <20240513220146.1461457-4-yury.norov@gmail.com> Date: Tue, 14 May 2024 23:02:00 +0200 Message-ID: <87jzjwkszb.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, May 13 2024 at 15:01, Yury Norov wrote: > The function may be called with housekeeping_cpumask == cpu_possible_mask, How so? There is no cpumask argument in the function signature. Can you please be precise? > and in such case the 'isolated' cpumask would be just empty. > > We can call cpumask_clear() in that case, and save CPU cycles. > > @@ -282,8 +282,10 @@ static ssize_t print_cpus_isolated(struct device *dev, > if (!alloc_cpumask_var(&isolated, GFP_KERNEL)) > return -ENOMEM; > > - cpumask_andnot(isolated, cpu_possible_mask, > - housekeeping_cpumask(HK_TYPE_DOMAIN)); > + if (cpu_possible_mask != housekeeping_cpumask(HK_TYPE_DOMAIN)) > + cpumask_andnot(isolated, cpu_possible_mask, housekeeping_cpumask(HK_TYPE_DOMAIN)); > + else > + cpumask_clear(isolated); > len = sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(isolated)); > > free_cpumask_var(isolated); Seriously? You need clear() to emit an empty string via %*pbl? if (cpu_possible_mask != housekeeping_cpumask(HK_TYPE_DOMAIN)) { if (!alloc_cpumask_var(&isolated, GFP_KERNEL)) return -ENOMEM; cpumask_andnot(isolated, cpu_possible_mask, housekeeping_cpumask(HK_TYPE_DOMAIN)); len = sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(isolated)); free_cpumask_var(isolated); } else { len = sysfs_emit(buf, "\n"); } That actually would make sense and spare way more CPU cycles, no? Is it actually worth the larger text size? Not really convinced about that. Thanks, tglx