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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 741B2C2B9F4 for ; Thu, 17 Jun 2021 09:11:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C8E5613E9 for ; Thu, 17 Jun 2021 09:11:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231453AbhFQJNP (ORCPT ); Thu, 17 Jun 2021 05:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231445AbhFQJNN (ORCPT ); Thu, 17 Jun 2021 05:13:13 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13336C061574 for ; Thu, 17 Jun 2021 02:11:06 -0700 (PDT) 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=2H4IM1xE7jxuGRrwhQQkIZ49SDStJc3NvFzU9prjeWc=; b=aZn7FZQiRpudLbgfubbkohBYEO 9FK1IHIEHwUo2JKOBMvyv6r9O014hEOtqipWTqq06v26HmIBnxhSSabGP8LbKzJG0eErKE6bf2dah buzBGeXwKk4XAXLh6qx1uI/FeHRXRCJAPWG+AOQab3hFWKpWKjymz43dJTOh3RnfrNevpPcGd6qcp x3hxAEmVb5Hj1Ho9991+dW5pQ1L0AGKx2I8GW3FXMS5miiNoRJBoxs5ggwxR/zRyB+V9mgt/5YZOt Vcb9G9gkZWIxCxq6lhkRQ/7V39QRqfjxCusfK0B0lTdUqfRLgNmVUGgkL7Bp+JORug70EGkzExySk VgjvhOFw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lto2c-008x6V-0J; Thu, 17 Jun 2021 09:10:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id AAB82300252; Thu, 17 Jun 2021 11:10:25 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9276D203C0549; Thu, 17 Jun 2021 11:10:25 +0200 (CEST) Date: Thu, 17 Jun 2021 11:10:25 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Nicholas Piggin , Rik van Riel , Andrew Morton , Dave Hansen , Linux Kernel Mailing List , linux-mm@kvack.org, Mathieu Desnoyers , the arch/x86 maintainers , "Paul E. McKenney" Subject: Re: [RFC][PATCH] sched: Use lightweight hazard pointers to grab lazy mms Message-ID: References: <1623816595.myt8wbkcar.astroid@bobo.none> <617cb897-58b1-8266-ecec-ef210832e927@kernel.org> <1623893358.bbty474jyy.astroid@bobo.none> <58b949fb-663e-4675-8592-25933a3e361c@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 17, 2021 at 11:08:03AM +0200, Peter Zijlstra wrote: > On Wed, Jun 16, 2021 at 10:32:15PM -0700, Andy Lutomirski wrote: > --- a/arch/x86/include/asm/mmu.h > +++ b/arch/x86/include/asm/mmu.h > @@ -66,4 +66,9 @@ typedef struct { > void leave_mm(int cpu); > #define leave_mm leave_mm > > +/* On x86, mm_cpumask(mm) contains all CPUs that might be lazily using mm */ > +#define for_each_possible_lazymm_cpu(cpu, mm) \ > + for_each_cpu((cpu), mm_cpumask((mm))) > + > + > #endif /* _ASM_X86_MMU_H */ > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 8ac693d542f6..e102ec53c2f6 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -19,6 +19,7 @@ > > + > +#ifndef for_each_possible_lazymm_cpu > +#define for_each_possible_lazymm_cpu(cpu, mm) for_each_online_cpu((cpu)) > +#endif > + Why can't the x86 implementation be the default? IIRC the problem with mm_cpumask() is that (some) architectures don't clear bits, but IIRC they all should be setting bits, or were there archs that didn't even do that?