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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30F5EC433EF for ; Thu, 16 Jun 2022 09:45:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B4FEF6B0072; Thu, 16 Jun 2022 05:45:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AFF906B0073; Thu, 16 Jun 2022 05:45:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A0606B0074; Thu, 16 Jun 2022 05:45:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 865916B0072 for ; Thu, 16 Jun 2022 05:45:13 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 59F33120438 for ; Thu, 16 Jun 2022 09:45:13 +0000 (UTC) X-FDA: 79583615706.20.756E598 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf27.hostedemail.com (Postfix) with ESMTP id F10B240099 for ; Thu, 16 Jun 2022 09:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=EZ8NU+0w2F5SD78Q+6uxvFt+DO+F+fvNNYXfPlfLgcI=; b=lynUDM/hMhZEZmLGxZWZU+3h1Q 8V0+gQMhmdZfNddmtIlBBjkwLJf7KOk3T4eljm8z7suhTpxNCNU8ny1wCZllNNEO7SGebgoPkjNRP lfafb3kJi459hMdxH9f+cvYnyQKajRNSLry4r+hPBghzZdZwn73JUV4c+GzOU2Uj+TsUrea30z9mq v/99kdh62FfTN0GwwUY/M3G2W/qrOMlKVl4QBYBwS5/8jEJgsl22Stjq7nLFlOE3LVuMJ6x9/deiG yObiPXD8mQ3v8a3SA22ncYWQoR6aSt+RfgcRpdOEpYb4OsY2qZmG+eJ4jFWYYyE9eMpdvsytfNefR /u3EH0UQ==; Received: from dhcp-077-249-017-003.chello.nl ([77.249.17.3] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1m3g-008Njg-EB; Thu, 16 Jun 2022 09:45:03 +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 (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F3C333031CB; Thu, 16 Jun 2022 11:44:59 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DF5BB2014ABD6; Thu, 16 Jun 2022 11:44:59 +0200 (CEST) Date: Thu, 16 Jun 2022 11:44:59 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Rick P Edgecombe , "Kirill A. Shutemov" , Linux Kernel Mailing List , "H.J. Lu" , "linux-mm@kvack.org" , Dave Hansen , "andreyknvl@gmail.com" , "kcc@google.com" , Andi Kleen , "dvyukov@google.com" , the arch/x86 maintainers , "ryabinin.a.a@gmail.com" , "glider@google.com" Subject: Re: [PATCHv3 6/8] x86/mm: Provide ARCH_GET_UNTAG_MASK and ARCH_ENABLE_TAGGED_ADDR Message-ID: References: <20220610143527.22974-1-kirill.shutemov@linux.intel.com> <20220610143527.22974-7-kirill.shutemov@linux.intel.com> <20220610180635.l44opq2votd3gxpl@black.fi.intel.com> <5b56c88e477d879e5a0e3c15627cb05901a812f4.camel@intel.com> <5d3b281f-3d8b-4bbd-9681-b226810c3e8b@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5d3b281f-3d8b-4bbd-9681-b226810c3e8b@www.fastmail.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655372713; a=rsa-sha256; cv=none; b=hrg0fAmbI3n6iHRGTxFNCDjNvmwNaOdgpHquF2vqRFfjuuUpcCBr/CPIOnaVDqrTiq7BrM 5Aky+yB7yId+YBRqu+RIDe8jl+pVGT2qf/3oxhLK7TfkiB0lpYg7m+ZSjNvoW5L4o0l36e QbUFysMdv2x7OMEFqwZD/V7ZfpqvjPc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b="lynUDM/h"; dmarc=none; spf=none (imf27.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655372713; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EZ8NU+0w2F5SD78Q+6uxvFt+DO+F+fvNNYXfPlfLgcI=; b=fpNb9H6tIEwT/MoERpCYwayYu2fXCN18mLgeo7I3EBx026TjLUhnqr71bMAHF7z2u47gIb jxi3wHPMDtZ2uVKK3iePnkecayp4QCmXwTPoV3IcfqCGT7pbSta1zi/n/dF/Hyjr9tX+UC hXEYLUyqNN+kMEUwJiojNhSZFegJ7wU= X-Rspamd-Queue-Id: F10B240099 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b="lynUDM/h"; dmarc=none; spf=none (imf27.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org X-Rspamd-Server: rspam06 X-Stat-Signature: ymkzbnnjs863cu97quqerqcz65ma45m4 X-HE-Tag: 1655372712-679400 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: On Sun, Jun 12, 2022 at 02:03:43PM -0700, Andy Lutomirski wrote: > >> > > > + /* LAM has to be enabled before spawning threads */ > >> > > > + if (get_nr_threads(current) > 1) > >> > > > + return -EBUSY; > >> > > Does this work for vfork()? I guess the idea is that locking is vfork() isn't the problem, the problem is that Linux allows CLONE_VM without CLONE_THREAD. Now, mostly nobody does that these days, but it is possible. > get_nr_threads() is the wrong thing. Either look at mm->mm_users or > find a way to get rid of this restriction entirely. mm->mm_users should indeed be sufficient here. > IMO it would not be insane to have a way to iterate over all tasks > using an mm. But doing this for io_uring, etc might be interesting. That has come up so often over the past 15+ years I've no idea how come we've still not managed to actually do that ;-)