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 388CCC3DA42 for ; Wed, 10 Jul 2024 19:27:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C07D06B0082; Wed, 10 Jul 2024 15:27:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB7706B00C8; Wed, 10 Jul 2024 15:27:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A59206B00C9; Wed, 10 Jul 2024 15:27:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8544C6B0082 for ; Wed, 10 Jul 2024 15:27:49 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3A657120160 for ; Wed, 10 Jul 2024 19:27:49 +0000 (UTC) X-FDA: 82324827858.08.135DF25 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf06.hostedemail.com (Postfix) with ESMTP id 3A0D8180016 for ; Wed, 10 Jul 2024 19:27:46 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=arista.com header.s=google header.b=LEfkWRdN; spf=pass (imf06.hostedemail.com: domain of dima@arista.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=dima@arista.com; dmarc=pass (policy=reject) header.from=arista.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720639636; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lDX0XdF8xtUi8gY57mjJHI/aPqtEadEtWnhLks81CaM=; b=t8+eQr2hVYA2EA3VQ0CzSYvGoALIGdEpNuvdgOoDvI5wgHudBWl/lCkWeYGBwvpC/6va7x GeP+q1oflNIuBF6xNG+0+rvRRRGzaLG4TTNYJswSyBrwXCtp7CDQUAuu3SBha0tt3TyvbA H0aK2G79JoNxovZNFYvFwbVqCyorO8c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720639636; a=rsa-sha256; cv=none; b=Nz2MKf08HlY2XiBPEQAtvB0RlVLjI0ztMo1+9e0a7BTYGq4wKPd54sxoWO1NEeZGuFbwa3 JIk6D6Js3urfLiAzwFb1YuPGTqNE68txOOcrLHj+ckdlRIoNmGbHHbbMgQ4RVzYORS2+tB xVgvkxilvN9tfZVrnwHy9NdSP1tMiAY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=arista.com header.s=google header.b=LEfkWRdN; spf=pass (imf06.hostedemail.com: domain of dima@arista.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=dima@arista.com; dmarc=pass (policy=reject) header.from=arista.com Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2c9a10728abso137973a91.0 for ; Wed, 10 Jul 2024 12:27:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=google; t=1720639666; x=1721244466; darn=kvack.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lDX0XdF8xtUi8gY57mjJHI/aPqtEadEtWnhLks81CaM=; b=LEfkWRdN0K4RYCDWCyYEhs1fEJLUCp7l6NoD75Y7POaR9UyahV5QZLcmPqHAerj+PB SMA6ye9JMRuZCMuIUqMpaS6smioHoQv5LjM29yHUpW0yD5drDXgsDuM46IxZbeI2F8i8 Ac3u8yb5DLduQ8MsPOjNFK1fuZ8C0Tgludm5vCrBld7P4XDMPBFAP2uHyPJ6CL6GqKnb jMgJYq+gyQjt7XTsxaOH8S0Ph55YSn5HDEU++A+mzad+LqSYiQRU/MOg8VmLr75uYoWP NQT3H6WIMy7s/JQrA4Vb3whj0JkYsKosS1w6pmLnaRu+PN2oBVCGIrtO+tQITRTO2ZXA cLYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720639666; x=1721244466; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lDX0XdF8xtUi8gY57mjJHI/aPqtEadEtWnhLks81CaM=; b=hjZxVyHLb8QX7n3C2lnK4NeTxwFR0h+Cn1A3GFZ5GsV4A4ynFuSacNYX2PysEhSzV/ QBxGaOt8cHvjs40M4VzZgOFvPNxJakZE27ffOK5aJxLTwkcAO61QWdif+Cb6lLn4N1aj BIgSLxHp1Dx2ZnaMNZtvRIcg796waVvNn44+TGOe2MCgUr1SgDA3uZ0/QK8gDyH/dTU5 PZY0PDZ3V77JcJpiWMXsnBjXgQ278KcXdcyOEYB9LoesTkvdMvjgUl3tGogq8FIaszJS Og65BuGnhyS+bbI9gSzlOaPJvGDok9j0q9FJxDbgcWxnDve/TIAkE9WEBw/afWipDYBS lgig== X-Forwarded-Encrypted: i=1; AJvYcCU/pqzknrhgam8lCaKcoWS7hiMYW00UJe69MgOL7IblC/bmt5acQ4fRStNjQtYPVIDvEqvWE23Sme7CGGolkrCcbhU= X-Gm-Message-State: AOJu0YxQ3hrUJe1/zMVGnck8Pkqct1f/8MgunYFO9/WOzSC8UldhzuBA ihWIcMhI+jrJD4iH89Ndf8oyZkR0ax7VmXjlryHcd8V3udiK+qqoSYGccS/4NXpnLs7O+v1qcvD ETHVm+WGv2v+17nzEVp00kSFDsymUoCWcNVw1 X-Google-Smtp-Source: AGHT+IFevCQuz+QUBppsNr3ykaDTOUJGvGoxbbyyoYnSvNNxylRM8YDW9XfsPb9VBk0DCwpi4bmqsSw+rxSkjF9wNFU= X-Received: by 2002:a17:90a:71cb:b0:2c9:9b65:af4d with SMTP id 98e67ed59e1d1-2ca35bdffd5mr5203439a91.7.1720639665835; Wed, 10 Jul 2024 12:27:45 -0700 (PDT) MIME-Version: 1.0 References: <20240704182718.2653918-1-Liam.Howlett@oracle.com> <20240704182718.2653918-17-Liam.Howlett@oracle.com> <8fbb424d-a781-4e61-af7a-904e281eba8c@lucifer.local> <0998f05b-9d5f-4b24-9030-22421e1dd859@lucifer.local> <874j8x5t4e.fsf@mail.lhotse> <92ce2025-51c3-423a-902e-dbd19d5d7850@lucifer.local> <7161cef3-49e4-4057-8a66-ec1ad6eb3f9e@cs-soprasteria.com> In-Reply-To: From: Dmitry Safonov Date: Wed, 10 Jul 2024 20:27:34 +0100 Message-ID: Subject: Re: [PATCH v3 16/16] mm/mmap: Move may_expand_vm() check in mmap_region() To: "Liam R. Howlett" , LEROY Christophe , Lorenzo Stoakes , Michael Ellerman , "linux-mm@kvack.org" , Andrew Morton , Suren Baghdasaryan , Vlastimil Babka , Matthew Wilcox , "sidhartha.kumar@oracle.com" , "Paul E . McKenney" , Bert Karwatzki , Jiri Olsa , "linux-kernel@vger.kernel.org" , Kees Cook , "linuxppc-dev@lists.ozlabs.org" , Dmitry Safonov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 3A0D8180016 X-Stat-Signature: bb6r48qpw9o6f4pzm6e4aur8kynm7tzu X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720639666-16813 X-HE-Meta: U2FsdGVkX187w54gEBnYTYOPEck+ebzfUZhSi+JQBiv2fqsTuPCgcgNCpGSVLXiSC80CzcVN0lx9KzQZeJNpQ1pYiPz0bidowD2yxQlz0pUmyd6RDqstbrCm437gUio8eAcndl669VDYAF9mMuZy0ijW52EjcpDMzH5aqpxESFvMgeRj1Sjix5iPPz54uwrhhz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g3MXvzxUH7wOOct2MZAx9TcEMkTG4BRe8xQSZ4TL6tRGbgkRPdkJsdWMVTi8nEsvKnlcgJWL/JvjzSFmdmYNpAiX0BnAKM//zT7nZbS76ZupLV2UC00hTDlxiLam2U7XBXnSm4U56Gbcf+auJI7ht7p78C73mVfUy+HQthj1KA3UIYbvvMV26QXnIL1rM4uYYg9cbcHuT33UQQBHU= 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: List-Subscribe: List-Unsubscribe: Hi Liam, On Wed, Jul 10, 2024 at 5:09=E2=80=AFPM Liam R. Howlett wrote: > > * LEROY Christophe [240710 08:59]: > > > ... > > >>>> > > >>>> Assuming the removal of the vdso does not cause the application to= seg > > >>>> fault, then the user visible change is that any vdso call after a = failed > > >>>> mmap(MAP_FIXED) call would result in a seg fault. The only reason= it > > >>>> would fail is if the mapping process was attempting to map a large > > >>>> enough area over the vdso (which is accounted and in the vma tree, > > >>>> afaict) and ran out of memory. Note that this situation could aris= e > > >>>> already since we could run out of memory (not accounting) after th= e > > >>>> arch_unmap() call within the kernel. > > >>>> > > >>>> The code today can suffer the same fate, but not by the accounting > > >>>> failure. It can happen due to failure to allocate a new vma, > > >>>> do_vmi_munmap() failure after the arch_unmap() call, or any of the= other > > >>>> failure scenarios later in the mmap_region() function. > > >>>> > > >>>> At the very least, this requires an expanded change log. > > >>> > ... > > > >>> I mean why are they unmapping the VDSO, why is that valid, why does= it need > > >>> that field to be set to NULL, is it possible to signify that in som= e other > > >>> way etc.? > > >> > > >> It was originally for CRIU. So a niche workload on a niche architect= ure. > > >> > > >> But from the commit that added it, it sounds like CRIU was using mre= map, > > >> which should be handled these days by vdso_mremap(). So it could be = that > > >> arch_unmap() is not actually needed for CRIU anymore. > > > > > > Oh that's interesting! > > > > > >> > > >> Then I guess we have to decide if removing our arch_unmap() would be= an > > >> ABI break, regardless of whether CRIU needs it or not. > > > > > > Seems to me like an internal implementation detail that should hopefu= lly > > > not result in anything that should have visible ABI impact? > > > > > > I guess this is something we ought to assess. It would be useful to > > > eliminate hooks where we can so we can better control VMA behaviour w= ithout > > > having to worry about an arch being able to do arbitrary things at > > > unexpected times, especially pertinent where we change the order of t= hings. > > > > > > > I see you are talking about arch_unmap(). I didn't follow the entire > > discussion but we have some related stuff here: > > https://github.com/linuxppc/issues/issues/241 > > > > If I remember correctly arch_unmap() should have gone away we Dmitry's > > series > > https://lore.kernel.org/lkml/20210611180242.711399-1-dima@arista.com/#r > > but it hasn't been applied yet. > > > > That is good news! > > To review, ppc is the only arch using this now and it sounds like you > want to remove it too. > > Considering the age of that thread and the possibility of conflict with > my series, can I drop the entire arch_unmap() function instead of > modifying the handling in core mm? I'm going to assume that's okay and > start working on this for v4 (because there hasn't been a public reply > for v4 since 2023/10/11). Yeah, this kind of felt through the cracks. I meant to find time to push v4, but from my job side I got motivated to do core networking changes that were required by customers, from the other side I got demotivated a bit by slight pushback for v3 with "justify why is it needed at all?". For changes that are mostly cleanups and refactoring. So, usually I don't give up on patches sets that yet make sense to me, but priorities+motivation changed and the set moved lower on my todo list. If you have time and urge to finish this patch set, you are more than welcome to adopt it :-) Otherwise, I'll try to find time for them, but not in near short-term as at this moment I cook tcp & selftests changes that I'd love to see upstream. > This would mean less arch-specific hooks and that's always a good idea. Thanks, Dmitry