Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2795933lqo; Tue, 14 May 2024 09:19:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNfDd4AWIglT7t5EggzFzech8ybvYzwuOFhBLL/hghAZ0LjdGQEqzqIWo9o6DM5g7HSTc5yCX9YW63eyfc/C/BhgI579lyVLDDV1uiRg== X-Google-Smtp-Source: AGHT+IGXPPF6jV3rj3Zb2ZSPppR0WQQcu7cTHkSiSOXWfpvj/m9RsCiAvj/ubgJGKDMD0dbWczPv X-Received: by 2002:a17:902:ea0c:b0:1eb:2f25:c43c with SMTP id d9443c01a7336-1eef9f34715mr224724135ad.3.1715703541251; Tue, 14 May 2024 09:19:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715703541; cv=pass; d=google.com; s=arc-20160816; b=f1RQP9Ir76Wl4Zc4u8WZXEalX94NudQjUBQxaHOVPgtWbz3hZYSAKpAG3j4s+0Jjx3 +YeVzHly9rH8Ssmz39BYmgzH66wMyBl0aktIfMDoTOtrZ1T7P6XqQV/yj+ViSKEiROgB n1bir6m9ywxrbdiL7b6Ce4H1tdEDGfBjUN7NXngdk3fvtOaxzr9q2WiydhdAzUhU8omH Q6LocxVfUjGkeDA5JgkVMktzV719Bq2bJDlovjqxoWKSPumPGWV4wzah55sYdLPfuSDx z7FweY+6U48/pYtIY3w7s1sg8xSFOOSdL/8lSyg5UOIGla6u1doO/6WblckoLwtglcz+ NtCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=WNm7JNft7mpO8BN214kXK8UmHAE1xVMf/yTHb94B3/E=; fh=v5u3N2m6+ua5kZuH6RiASnmAOQomaFLBQOy+mOXQN8Q=; b=MuCk+PDI34w1xFKDkktKWnxl2LqurSaEq/1/WtlLOjXL6ee0x2AoOariB68Bv800sv RS707AsF/+sQNLr18OtLTpC9YsTwXCDuo0Bx8+SFUfCOQlzWz4aFPPVY2p6e3Q/p8tIn HB50wQuKgvq3JGsic3KwhKuClewmD0ChZxCO99A0GVpetbv9iwSDkOH3it1FYmhEyDzc /iUwFOvMhicipa+QHv7Aozb/U4D/eDnFg4szH6SJ6dAlI45fNYo2dRZRZVnfwa34xotO qnX1xKaFamSWeXzvJ07/p51iVP/K+hY7h3/lHy33MGM3HRBoDJhQ6vhy3xLIsPatf/uN 7w5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UWML6iTQ; 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-178937-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178937-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 41be03b00d2f7-634103f7017si12431466a12.346.2024.05.14.09.19.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 09:19:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178937-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=UWML6iTQ; 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-178937-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178937-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 544C1283D12 for ; Tue, 14 May 2024 16:18:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7001181338; Tue, 14 May 2024 16:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UWML6iTQ" Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 43E1D17F36E; Tue, 14 May 2024 16:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715703380; cv=none; b=Z4EyJwdQsB2VGjvB+6GTKJfUb3yNtxMWpKTVcEt8q3d456Gh/7ibIynt/v98KHE3vb0Ff01Y/vDE18ROw12jmmAPy+ueRHJ9Od7xI2Fej89Ap75OcYmtQgtOk9GAL00JzVXyQVwQhfr7ae3pd+9qC+v6VuffshgkhkIVIPydyNg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715703380; c=relaxed/simple; bh=tI5iqDOiTiYC4B7GifYHnbpZJY2dKaCl033UC642iOs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=IVgOxerGCUNEEyGJccUwAqE7wz/M7rJ2sd1TQxB9rmX+HGYwT6w/nzZVyA3Yl/DaPNrQ7CxUtK8JhFEEzrnC+QBDQV5iFFzE1UKFxfOm+E4mcX9W1S9pZhw5f4RsyoMz0xXqrOIMsMiEqjjdhOX3ZmSUspvIuvdSgDS4vRcG94c= 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=UWML6iTQ; arc=none smtp.client-ip=209.85.208.180 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-lj1-f180.google.com with SMTP id 38308e7fff4ca-2e6792ea67dso62918121fa.3; Tue, 14 May 2024 09:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715703377; x=1716308177; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WNm7JNft7mpO8BN214kXK8UmHAE1xVMf/yTHb94B3/E=; b=UWML6iTQfCPG/NfXeEnRGmI6/xONjTTr8nM9Wl7cukf2fhmNFO8lmk0URRRt9S+IUg UnRtW7q9UrOUKEsub8Ag8vGtT02kitfTYBG/KXa2azqxwr7fltxeXxbFfFSqfIaeM7FY nrYW4YHMCT81vAs2xUQmWYF01jgPH1gxLUYH6WgMxlyu4K9ujPCFtJ3KQgsy4eDTMUMF wocOcraDNypnxNRB/9UutdrGSqZ6WcRE5QT0TwkIRYCmeB/AnensW/PXu4xGavTx/l4b vYjvQcK+3nhjFVxXN77EXfJqqPZhIVs8p8Lh1gne8ttEDqmSe+QKm9uPCdanExBKUcRl ScsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715703377; x=1716308177; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WNm7JNft7mpO8BN214kXK8UmHAE1xVMf/yTHb94B3/E=; b=XuzCVItdbrsi6mIpq2q7UIDMDu7mGfLPilM5TFYgS+HRb0xwvRQ/VbED0+SocLs9iV pMpdK55PQhiC0lUC1Su3yUpIh77UmH6nj8t9RVmpjxg2riFCdVtO0pNqfzfaMJu46jF1 Qbc4YHuzRB17VozH1y2XfgmX9tATKJAVYxCpjkrEYmrdwI4XpEOCBL8GZS2eM4AL/C0R cwW24w1Hu6GiSqr91u9hqga07z9aQ1cWHIso9AEMYhJHqKLOOcpJ0rbSTVFJCfVsFcaW P9soG8AvwZBlC/44eXgtZ3guZANSwb7nsyErgl0Eu4bgZ9zGHFqbY763ou4nqzjgLbQf I9dQ== X-Forwarded-Encrypted: i=1; AJvYcCVfgxwKxWM+p60rSnspPeyyC/EnUn5p06VTHhj/mWvq5pkRACf1cHxiGsezB6uq4uAklBD5ffny4YOffE5k6ijXrxT41QNSPg== X-Gm-Message-State: AOJu0YxU4uz7RHfuhNR3tXSNrm7lFXJ+Nkf0wU8ADvFmfp7QA0X8eQXD /DPEhfBErPDZ0HJjBz0Gt/4cjH7AaoVt36ncJA3cNbfqOgXg5VQaLgyGneyuMJz5yFBeBg5LP3b l7+hmY1x9a7dge9Q+Wmvcnyxxtyc= X-Received: by 2002:a2e:9c8f:0:b0:2e3:991:52ad with SMTP id 38308e7fff4ca-2e52039d6ecmr104912011fa.44.1715703376994; Tue, 14 May 2024 09:16:16 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240513220146.1461457-1-yury.norov@gmail.com> <20240513220146.1461457-5-yury.norov@gmail.com> In-Reply-To: From: Yury Norov Date: Tue, 14 May 2024 09:16:04 -0700 Message-ID: Subject: Re: [PATCH 4/6] genirq: optimize irq_do_set_affinity() To: Jinjie Ruan Cc: 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 , Zefan Li , cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 14, 2024 at 5:51=E2=80=AFAM Jinjie Ruan = wrote: > > > > On 2024/5/14 6:01, Yury Norov wrote: > > If mask =3D=3D desc->irq_common_data.affinity, copying one to another i= s > > useless, and we can just skip it. > > > > Signed-off-by: Yury Norov > > --- > > kernel/irq/manage.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c > > index bf9ae8a8686f..ad9ed9fdf919 100644 > > --- a/kernel/irq/manage.c > > +++ b/kernel/irq/manage.c > > @@ -285,7 +285,8 @@ int irq_do_set_affinity(struct irq_data *data, cons= t struct cpumask *mask, > > switch (ret) { > > case IRQ_SET_MASK_OK: > > case IRQ_SET_MASK_OK_DONE: > > - cpumask_copy(desc->irq_common_data.affinity, mask); > > + if (desc->irq_common_data.affinity !=3D mask) > > + cpumask_copy(desc->irq_common_data.affinity, mask= ); > > It seems that mask is a pointer, shouldn't use "cpumask_equal"=EF=BC=9F cpumask_equal() is O(N), just as cpumask_copy(), so we'll have no benefit if the masks are equal, and will double slow it if they aren't in the worst case. On the other hand, pointers comparison is O(1), a very quick tasks, even more the pointers are already in registers. > > fallthrough; > > case IRQ_SET_MASK_OK_NOCOPY: > > irq_validate_effective_affinity(data);