From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF26EC4332D for ; Thu, 18 Feb 2021 09:39:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCDF264E6F for ; Thu, 18 Feb 2021 09:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231644AbhBRJ3G (ORCPT ); Thu, 18 Feb 2021 04:29:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbhBRIRN (ORCPT ); Thu, 18 Feb 2021 03:17:13 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCFF6C061786 for ; Thu, 18 Feb 2021 00:16:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=u5vWM62XM8rLK2sqe8M5iVEY7D5xM2DiSE3Ouqp2Hb0=; b=ZzGJkQIFkEhYQfLXiSgclkToCz mMZb0I8ZCvlplD9MvUQmRZC7jEIGMOoSwvKj9TrBxNFbs3mK+tTeCL/m5jXyKnXArFNvo1QXcrVI5 TNLjvRoWldPAAo1Sau6EvvPsUGQiUvGC12qzDn002aMbYvTwdMO89v2zs74P9Qj0r+zeLBjj44LFn AZTmrR0glro3OwXCAC9h0qCOKaWLqRwpz7xMJzr0AODqzesvvLn7t9CNFl0+VlntEVKeQeFORhio2 BFZzGBKh7Zto9iP2iR9bitFlXctyI6qJZ5v81CPv5i0Ar5Gwgpyl4sJTbIxAemZ8FCpyF3F+Mfeek Lhhm+8fA==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lCeU4-001Pqj-0x; Thu, 18 Feb 2021 08:16:24 +0000 Date: Thu, 18 Feb 2021 08:16:24 +0000 From: Christoph Hellwig To: Nadav Amit Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Andy Lutomirski , Peter Zijlstra , Dave Hansen , Nadav Amit , Rik van Riel , Josh Poimboeuf Subject: Re: [PATCH v5 3/8] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy() Message-ID: <20210218081624.GA337128@infradead.org> References: <20210209221653.614098-1-namit@vmware.com> <20210209221653.614098-4-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210209221653.614098-4-namit@vmware.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 09, 2021 at 02:16:48PM -0800, Nadav Amit wrote: > + /* > + * Although we could have used on_each_cpu_cond_mask(), > + * open-coding it has performance advantages, as it eliminates > + * the need for indirect calls or retpolines. In addition, it > + * allows to use a designated cpumask for evaluating the > + * condition, instead of allocating one. > + * > + * This code works under the assumption that there are no nested > + * TLB flushes, an assumption that is already made in > + * flush_tlb_mm_range(). > + * > + * cond_cpumask is logically a stack-local variable, but it is > + * more efficient to have it off the stack and not to allocate > + * it on demand. Preemption is disabled and this code is > + * non-reentrant. > + */ > + struct cpumask *cond_cpumask = this_cpu_ptr(&flush_tlb_mask); > + int cpu; > + > + cpumask_clear(cond_cpumask); > + > + for_each_cpu(cpu, cpumask) { > + if (tlb_is_not_lazy(cpu)) > + __cpumask_set_cpu(cpu, cond_cpumask); > + } > + smp_call_function_many(cond_cpumask, flush_tlb_func, (void *)info, 1); No need for the cast here, which would also avoid the pointlessly overly long line.