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=-7.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 D7785C2B9F4 for ; Thu, 17 Jun 2021 10:00:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 69A7E613F5 for ; Thu, 17 Jun 2021 10:00:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69A7E613F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E2E086B0070; Thu, 17 Jun 2021 06:00:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB68C6B0071; Thu, 17 Jun 2021 06:00:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE2456B0072; Thu, 17 Jun 2021 06:00:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0247.hostedemail.com [216.40.44.247]) by kanga.kvack.org (Postfix) with ESMTP id 8972C6B0070 for ; Thu, 17 Jun 2021 06:00:29 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1E338180AD807 for ; Thu, 17 Jun 2021 10:00:29 +0000 (UTC) X-FDA: 78262770978.09.5F3FD71 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf26.hostedemail.com (Postfix) with ESMTP id 78667422496A for ; Thu, 17 Jun 2021 10:00:22 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id 11so2640836plk.12 for ; Thu, 17 Jun 2021 03:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=27sMd2moHgzQvQjtsTsdW0WmOcaUMLnHlf1rpJWHkIk=; b=p0wXy2XYJozttoKUdpv21S9gx/9ogI4iB9q9kzw57Bzqa50zF02B0SiLYejvEPOVuK XIvpwUMDLvlefk4PD0kgUTjdNxcyT17PP/uKDkiMkJCCRe22c4GduYAwwP0xwXURixRF 8xakFRh7YhcSXbIC7uiXlZNMZZoHAiNdjYRcQVnBimrh5IwD6fcW5/b8M4jl+iBh/9VQ DcQG8x7oq9JBj6qND+PHLJZLyjVK0hOY+MOrh95BLW5gycoruHhs4CSpP13J0HeIVt67 WCIVck+20ad2dzzftLph4nrHlqsw8cQW1FKVzp3SMLFdAGEB94snZCeSE8bqZuA44KZe Xhzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=27sMd2moHgzQvQjtsTsdW0WmOcaUMLnHlf1rpJWHkIk=; b=p+bjQMML4LEUwQRpglokFl/Wc7ONcNo7MzQYD/NjxwdHXdSDjBwPxlbooi+l+XGeJM we6xc+I6RkZi7gvKyh0lvlNysqp7GyQtUVCN/XkQ+9RxWTOdRY/V/eBgIpzm33J+S4LJ mK4WpvBAqs9ZIo4pU+UFEgDqK5BvH12gW0h2jzPYo4qDZ4IIwzTGzjTdKuDMT+Z7yf06 0/7p6S6E0BwvlWQXOATICseaH0Xx81mEvxL8o9gK96y1DmkPFawUO4yfGJFLivmhAvEZ Omv4z6TvGVAJ3YAp4BKnVWx9hiEKHR1Pc0SuLcQHQo3KJsqX/n0Z9Msex5gcHNobpRQw kfVg== X-Gm-Message-State: AOAM532LpGUluyYAmUlIZNuJRK/j30/5TZh3Zu/nTKbOCtnuBeSBXM8h qUc6KdKVeaAQip4UC3oRyXU= X-Google-Smtp-Source: ABdhPJxxuh69FWPW4fUP0ExfHicJfooHaJwLOUNdovwUAzKmPk5QGOjkIDV9iiUXaYD8zSk0gUCpNw== X-Received: by 2002:a17:90a:a087:: with SMTP id r7mr16033072pjp.84.1623924027936; Thu, 17 Jun 2021 03:00:27 -0700 (PDT) Received: from localhost (60-242-147-73.tpgi.com.au. [60.242.147.73]) by smtp.gmail.com with ESMTPSA id t1sm4659988pjs.20.2021.06.17.03.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 03:00:27 -0700 (PDT) Date: Thu, 17 Jun 2021 20:00:22 +1000 From: Nicholas Piggin Subject: Re: [RFC][PATCH] sched: Use lightweight hazard pointers to grab lazy mms To: Andy Lutomirski , Peter Zijlstra Cc: Andrew Morton , Dave Hansen , Linux Kernel Mailing List , linux-mm@kvack.org, Mathieu Desnoyers , "Paul E. McKenney" , Rik van Riel , the arch/x86 maintainers 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> In-Reply-To: MIME-Version: 1.0 Message-Id: <1623923470.ex9n1iunep.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=p0wXy2XY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of npiggin@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=npiggin@gmail.com X-Stat-Signature: jbgc79a31jamuduirfh7bdi6d4jpicxk X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 78667422496A X-HE-Tag: 1623924022-618570 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Excerpts from Peter Zijlstra's message of June 17, 2021 7:10 pm: > 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: >=20 >> --- 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 >> =20 >> +/* 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 */ >=20 >> 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 @@ >> =20 >=20 >> + >> +#ifndef for_each_possible_lazymm_cpu >> +#define for_each_possible_lazymm_cpu(cpu, mm) for_each_online_cpu((cpu)= ) >> +#endif >> + >=20 > 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? There are. alpha, arm64, hexagon (of the SMP supporting ones), AFAICT. I have a patch for alpha though (it's 2 lines :)) Thanks, Nick