Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3609743pxt; Tue, 10 Aug 2021 07:25:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz23JYsmT6FO/lD33AGrV7ZY4jlFfbVwxQr8MhYewSZ74bi2pb9zxRmzgkll/psLhs9Crkd X-Received: by 2002:aa7:d40e:: with SMTP id z14mr48389edq.250.1628605540673; Tue, 10 Aug 2021 07:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628605540; cv=none; d=google.com; s=arc-20160816; b=uEi0QAHofvuxJmmME4qOPCfF6t2PB4wCjT/kPD2xxYzW0ml4spU1NOiQ0wCWhC9He+ WbGsEJBaih/ypxDX6s/FwKr8JCEYjhdbhCh8NOufpXX8QmcdsTzRIgcOtbme43IpRWaE wvn6yuG/3kKEhkemXpMkuZw8LhinD3Ld8CKvpD5CARhGEfuxsiJ/pfh26w0YywKrQcuQ XpCOL6DMDDAtv4GHvKZoZoxW1O9Y3Jpl07DWTJ4GNbTStEJ/6pJKLdknJzHCyb02XjrP tCxS4rC6neA1EzU7mpxIaI3gb79Mv7FxnK46pBnQXHNpuOv9qM0SQCzBo9U2z0HDHxvs T1rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=TiJmA3POi9FctASNMfUPbhLh0CEUmHRjBKpCXOyY61A=; b=LBLddtyaSDo4sTOvdc5aBkb5HFhKUN5nr6TTK/GBg+B2s/lG2tOqgyNjmcW2g+8VpE d/me/hY1fKqdsBn0LbDnSrmI6kUGup4YqkBO27YDucoN45A/KS8Qrf4smIO2PX59G7cX NAmBq+S+YJjR4zKJ6zUja7R5OWZQrfcnMeKXMujzPq9767Rp7W84Dv/sLIVoYjfXtMdw SI4f7ddA+PANoB8LCDRfK/g6ci9J+IGD6hxw9Rw5XQddkapV7sSD44mYmnmVm+aq3swE Q0O/XGMlJaWJJSlzzCu40/T9ytTTBiGIXwWiVoJBsaJnkq45vai8pGqjtFsw/nl9FE4m 35mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xw6VoRMG; dkim=neutral (no key) header.i=@linutronix.de; 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=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ee37si4235774edb.307.2021.08.10.07.25.07; Tue, 10 Aug 2021 07:25:40 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=xw6VoRMG; dkim=neutral (no key) header.i=@linutronix.de; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242159AbhHJONT (ORCPT + 99 others); Tue, 10 Aug 2021 10:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240580AbhHJONS (ORCPT ); Tue, 10 Aug 2021 10:13:18 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECEBFC0613C1; Tue, 10 Aug 2021 07:12:55 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1628604774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TiJmA3POi9FctASNMfUPbhLh0CEUmHRjBKpCXOyY61A=; b=xw6VoRMG1YZcz3aozL3rahY9dAgQCn2l2vSKWQ7AJbhWgF1WEQElAieDb5A4aNl7402Qsz 18wBjGzofgKkIqVGF+Am6JDlxKcY14fJ3VnQ7kCgJ/LW5gmusLivzK/5hG4ULV1FCkbt32 ASnzYiElDNcoKLgD5q2H3d3Ikg1jC2+5R0TKlTcc1vHHCD1QCr/MduHydq3d01zGmQP+ml UprbxgVqN/3BuDNKcJNe3ICWt4W27vwS1AJ7rptufqF+2dXIm5bfE0QsnPIXt/os19v67K FSFbIsYZDqDc6z8mH42Q/O0UpznkQmgwfK66EF8aptdUuausjNFyFXHySKiPXg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1628604774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TiJmA3POi9FctASNMfUPbhLh0CEUmHRjBKpCXOyY61A=; b=GQvIEL30+f0CmUBjLBwLCPb4AcR0xsmoX9poarHYh0pPPFV7tZGOlFa5JPgHk3z0qSKufX HAUHoYCIkXRo0NDA== To: Shung-Hsi Yu , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org Cc: Peter Zijlstra , Jesse Brandeburg , Nitesh Lal Subject: Re: [RFC] genirq: Add effective CPU index retrieving interface In-Reply-To: References: Date: Tue, 10 Aug 2021 16:12:53 +0200 Message-ID: <874kbxs80q.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07 2021 at 15:33, Shung-Hsi Yu wrote: > Most driver's IRQ spreading scheme is naive compared to the IRQ spreading > scheme introduced since IRQ subsystem rework, so it better to rely > request_irq() to spread IRQ out. > > However, drivers that care about performance enough also tends to try > allocating memory on the same NUMA node on which the IRQ handler will run. > For such driver to rely on request_irq() for IRQ spreading, we also need to > provide an interface to retrieve the CPU index after calling > request_irq(). So if you are interested in the resulting NUMA node, then why exposing a random CPU out of the affinity mask instead of exposing a function to retrieve the NUMA node? > +/** > + * irq_get_effective_cpu - Retrieve the effective CPU index > + * @irq: Target interrupt to retrieve effective CPU index > + * > + * When the effective affinity cpumask has multiple CPU toggled, it just > + * returns the first CPU in the cpumask. > + */ > +int irq_get_effective_cpu(unsigned int irq) > +{ > + struct irq_data *data = irq_get_irq_data(irq); This can be NULL. > + struct cpumask *m; > + > + m = irq_data_get_effective_affinity_mask(data); > + return cpumask_first(m); > +} Thanks, tglx