Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3174694pxb; Mon, 24 Jan 2022 04:14:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZvuXjAqCR1R6rxDitfV2gGhAKkk/PCim7vxRfMJ1Ox7aEWaqc3fmy/jroRdARCn7ZySae X-Received: by 2002:a63:b34c:: with SMTP id x12mr11566305pgt.541.1643026441286; Mon, 24 Jan 2022 04:14:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643026441; cv=none; d=google.com; s=arc-20160816; b=nGHpdIKFjDf79a8pGYsFG7WELheN1YR1MT5H+9hAFoIQ0RRrmI/2PJcidC0OGcJwYG TOFoSGn5Qpl9B/xLfK5DzVY3DqfiBkjQTV//CYwcHhUqPvdbj/+otVCVPgx0sOt+6Ar1 8G0hRQUUZxVmafyWMR8nj5NRo0v2rn1LGEyoo8ehbF+qf2bUP5qFPy3ouekgtOH8yPPa zmkm3cF0K35HSG8eQ8g93bshPZPVDdusuNb1+dJEFgMmihmei7cxpj/4wKdUUt1IZd5x Vit71I/sqoCxHQcmPJ+/SB7soa1Bxx5xUAqE179zM5mFSRcLFE7YelWspOsug/CUzjVT nmyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=475Re6o4qrxmTY2+dJD1szR+aZ9ztNBAVJwVf2XomiQ=; b=o4ekVgIrlALv+iRVyg0qRRlcz/cgjcdntEUStJOEV7WaCfTiVfNDWsRf9mNuC59GeK W64XbjyX5At5bTo8iCD0IgeKEdhVG3/rTUt3ypiOLXjVDyxDraX5PnbabiylfVOpmAKN bXkmTzptCR5CvTh0UXyc/NCWvmlzy3p46mBHqsGs+CTleneQZFfyK5uOCOMZTYf5l2Yu brsmzF5TQNzRGvoFYOeud2RUTr+v3fFuQKmxMZg2iJZRn4q7GzxRq8wslzK/lKNiZIrS f0cTAJnRWgcbcjHoo/+hlDbRl8+mKtOUxdiBw8C0IamYpjvBVyg/2OJZ28lfkYHg9ZWd c/4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jmVObv+D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 5si7344654pfi.72.2022.01.24.04.13.49; Mon, 24 Jan 2022 04:14:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jmVObv+D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239716AbiAWSlP (ORCPT + 99 others); Sun, 23 Jan 2022 13:41:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239629AbiAWSko (ORCPT ); Sun, 23 Jan 2022 13:40:44 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2414AC061748 for ; Sun, 23 Jan 2022 10:40:42 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id e8so13479916plh.8 for ; Sun, 23 Jan 2022 10:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=475Re6o4qrxmTY2+dJD1szR+aZ9ztNBAVJwVf2XomiQ=; b=jmVObv+DHvV/nfgWMGm7G0AiVWxWK811CYrpCGiHV6xY0cRphRK/F1bxcyarhazE7G QO3y6iESjwSCWQV4XxfbN0VGrGzLnz+MQAZouCPpYGATGaaGpx/xFlQQHIUbUBuvRRw5 0P/sPgZ/Zob1yCiUwsGdNVWUVVlgMqpf+xC55wv1WQFaeiZGDLCbtdTLECSRwzD1BwDr 5hJchQzstXRUP379uF+B/2jyU8zwFVQtEt3XnUASMZLgJzQPBHWzsJ7NMd9Pe5Hmto0M h6UFu1fpTLkx6o30OssQidiED5LGIyGRgU4+4B2Dhf6WKpYvcVZFv0Kk+WkaLBOUlnoc 3Wyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=475Re6o4qrxmTY2+dJD1szR+aZ9ztNBAVJwVf2XomiQ=; b=IgPEElMhsrwOZyqBIF6X1X3A2GiUz8JltvaSiye4L5nlMNr7f9as3XlpC5ufxV/1W0 FaHotqvrScV3VtyXf1BbeCL7VhpYjP1TF3TyFaYV+A+5earT0aRfy9uxOiRcebjbVxOS 4n9DKpTzSoX0Li/UtMurY/LN3VAItmXF8CBmA7qBTO+xmwtRFbYGdBZiSg8SAWicPiY6 1OpVGbf1r2fE3d3+LIMeRckJgDgLEMOgEQD9sDXRC/PFHzM1E6Qw6kILVWo/eXmH7fp6 mYI0uZg9R8D6aCDvxsLu+9K7uAEpUhTV4OyXCEevBLydmmFfdnR5VJEdb2gDFBvOhV5w VUYg== X-Gm-Message-State: AOAM533ML7IKXq8PPDxPeMFDiW+R0NPf0EQg+JY6HIe0qGkAADQEp7Ic +l3xuEaGLYnB8J7mCxLv/xE= X-Received: by 2002:a17:90a:460f:: with SMTP id w15mr9814786pjg.123.1642963241641; Sun, 23 Jan 2022 10:40:41 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id q9sm13712586pfk.137.2022.01.23.10.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:40:41 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 17/54] gpu: drm: replace cpumask_weight with cpumask_empty where appropriate Date: Sun, 23 Jan 2022 10:38:48 -0800 Message-Id: <20220123183925.1052919-18-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org i915_pmu_cpu_online() calls cpumask_weight() to check if any bit of a given cpumask is set. We can do it more efficiently with cpumask_empty() because cpumask_empty() stops traversing the cpumask as soon as it finds first set bit, while cpumask_weight() counts all bits unconditionally. Signed-off-by: Yury Norov --- drivers/gpu/drm/i915/i915_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index ea655161793e..1894c876b31d 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -1048,7 +1048,7 @@ static int i915_pmu_cpu_online(unsigned int cpu, struct hlist_node *node) GEM_BUG_ON(!pmu->base.event_init); /* Select the first online CPU as a designated reader. */ - if (!cpumask_weight(&i915_pmu_cpumask)) + if (cpumask_empty(&i915_pmu_cpumask)) cpumask_set_cpu(cpu, &i915_pmu_cpumask); return 0; -- 2.30.2