Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2412146pxb; Sun, 30 Jan 2022 15:41:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJ3EEuCa4wkqpRc8ZYbYZBeuI2Jqc2Yw0oCiBfvsx28qIiB+czWAsoJLHK9NKEaPS+mFtj X-Received: by 2002:a17:907:6293:: with SMTP id nd19mr14740060ejc.64.1643586102890; Sun, 30 Jan 2022 15:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643586102; cv=none; d=google.com; s=arc-20160816; b=MFA9LZx8VQsT196/cPYWn06dGF8yC8iQaBV/pN5gK0PiHnTOa9NDvNcW8IZjXdC/dC h16kQlyZghHnUVIzTm6bA4OQsvR3dKKuV8lDILUPjQALN44BKl8H13x2OmSfMqt7wrVp DmHDi/nmGmg0198j98ilY9DMWVmiWnp3FoC4WQ6TC8yei9/g1urxvTZP+pdi3HGUKlzx RLfsm26rP0Oy8RU0d2C0H/F76AG3yWNgdaJDnwqyrV/fnFV8eE7JPR0batGI4GXzPGpo S6+tg3rFbCGtTK8no6pGfXF4G8R5t9cU2gxlMNkFZ6GicxBxQzIw+b7q6dVYvU8m+g0q bb+Q== 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:cc:to:from :dkim-signature; bh=Quc4skgWQnhYb+89AvQYjxil+ByV/pBG/nU7QFXNosI=; b=dZH/k4tlF8ZNAABNEAoSkVI98MAn1ZPyVPrFm+Evoq4GEnq51vowjlsZO9tuAH1Kxw zNBu84fFfEepfziY3ec2fTUe99UXCUtUrJW4Xi/d0lpOn5mNMJcmBpIVNkky8nt5DG8s 3BpTfTj85VzZiINuyzMNntU44U/hev/x78R6uW6IiXVY+hkJzcIYpQZNqMuIFM0whOn+ dKuFZW6386XtiwNo2Vji57mn2uQwZLYOwR2tZCUD1zCj2TA8VFpLGXI19fRfUJI5jeIo y2xo0D03FHAqR4KE8qR9IlEFBL1mPsXk+2wHphmkH/Q3mi4/3TPgXSITBA8GdtVCw9dd 2HKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OmMl5+uK; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cr16si3151855ejc.975.2022.01.30.15.41.18; Sun, 30 Jan 2022 15:41:42 -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=@redhat.com header.s=mimecast20190719 header.b=OmMl5+uK; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231839AbiA1Kea (ORCPT + 99 others); Fri, 28 Jan 2022 05:34:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30242 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231618AbiA1Ke0 (ORCPT ); Fri, 28 Jan 2022 05:34:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643366065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Quc4skgWQnhYb+89AvQYjxil+ByV/pBG/nU7QFXNosI=; b=OmMl5+uKVGJe6Q4mJIUEzw2+Fbal5hzB1t/awcfjDE0l7KffIsVzZTONK6HQzBUuLdqKX1 SURJf6cCslomkuc10zr99u0x2Eex528oXZOyjl21Xe2DRh0zO4uAC8/n55jdaFPzZj80Ap EmCPYyeHYKGMR/OXij+dXPAU31gNYLQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-386-gM9IMD9IOuKE_VIN-ADfgw-1; Fri, 28 Jan 2022 05:34:22 -0500 X-MC-Unique: gM9IMD9IOuKE_VIN-ADfgw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 180CD1083F61; Fri, 28 Jan 2022 10:34:21 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.193.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id C790A7B6D5; Fri, 28 Jan 2022 10:34:18 +0000 (UTC) From: Vitaly Kuznetsov To: linux-hyperv@vger.kernel.org, Wei Liu Cc: linux-kernel@vger.kernel.org, Michael Kelley , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Dexuan Cui Subject: [PATCH 2/2] Drivers: hv: Compare cpumasks and not their weights in init_vp_index() Date: Fri, 28 Jan 2022 11:34:12 +0100 Message-Id: <20220128103412.3033736-3-vkuznets@redhat.com> In-Reply-To: <20220128103412.3033736-1-vkuznets@redhat.com> References: <20220128103412.3033736-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The condition is supposed to check whether 'allocated_mask' got fully exhausted, i.e. there's no free CPU on the NUMA node left so we have to use one of the already used CPUs. As only bits which correspond to CPUs from 'cpumask_of_node(numa_node)' get set in 'allocated_mask', checking for the equal weights is technically correct but not obvious. Let's compare cpumasks directly. No functional change intended. Suggested-by: Michael Kelley Signed-off-by: Vitaly Kuznetsov --- drivers/hv/channel_mgmt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 52cf6ae525e9..26d269ba947c 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -762,8 +762,7 @@ static void init_vp_index(struct vmbus_channel *channel) } allocated_mask = &hv_context.hv_numa_map[numa_node]; - if (cpumask_weight(allocated_mask) == - cpumask_weight(cpumask_of_node(numa_node))) { + if (cpumask_equal(allocated_mask, cpumask_of_node(numa_node))) { /* * We have cycled through all the CPUs in the node; * reset the allocated map. -- 2.34.1