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 F04F5C27C6E for ; Fri, 14 Jun 2024 18:39:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 456666B010A; Fri, 14 Jun 2024 14:39:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 425FA6B00F0; Fri, 14 Jun 2024 14:39:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 654EA6B00F0; Fri, 14 Jun 2024 14:39:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C59EC6B012B for ; Fri, 14 Jun 2024 14:35:54 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3FDAC1A08DD for ; Fri, 14 Jun 2024 18:35:54 +0000 (UTC) X-FDA: 82230348228.21.9773858 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf26.hostedemail.com (Postfix) with ESMTP id 44EC1140021 for ; Fri, 14 Jun 2024 18:35:52 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=i2ipNGHT; spf=pass (imf26.hostedemail.com: domain of "SRS0=OOQL=NQ=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=OOQL=NQ=zx2c4.com=Jason@kernel.org"; dmarc=pass (policy=quarantine) header.from=zx2c4.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718390150; 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=N8EBuid4q80uW/eoYI4M6BiKa1dNh0P0MAOlhzYgkd4=; b=fQyOkrUHfnrOH86VfvBGTqkdK5xxdmZ/xqO15Mqv5x/Lp5zHhquKMIFxDH6oo25ocFqjFg xpItQm6ZsTI5St/9BkuvBe+OdmxiyHnXyLkqaotw4bbxeg8P0aOEuiQZGSyxXGvHG6WpCX rqZDGKe/jalmK9l9E1M4/72/Eb0s8LM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718390150; a=rsa-sha256; cv=none; b=Ra3dikf0QuKuUNXdV3/IHZmehIEMUz936ZU1jx+qgJPRl9Role4ZLoHEi8yJzOtOjQ1wQq W6LggWmUhsUxiKIc0obmFzyaQR62z/VxzmDryyGi0sVtS3LrukDCfsE6sc35KtsPOs60oo kF9FYL0BYkRhbBLQGb4fR1a6klfb9fc= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=i2ipNGHT; spf=pass (imf26.hostedemail.com: domain of "SRS0=OOQL=NQ=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=OOQL=NQ=zx2c4.com=Jason@kernel.org"; dmarc=pass (policy=quarantine) header.from=zx2c4.com Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1FBEF62031; Fri, 14 Jun 2024 18:35:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C632C2BD10; Fri, 14 Jun 2024 18:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1718390147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=N8EBuid4q80uW/eoYI4M6BiKa1dNh0P0MAOlhzYgkd4=; b=i2ipNGHTfG1yOnnWQvVlSDsyrAeQEvUAWla+HRxu/DiTW3T7+Y4kwVuoIMmNzkw1PlMGd7 AmeJxKG83pPFRHG1XKQu7RO81WyznGuwBQPH0/8GOE7GtYvaR2CsuAq6o8PPlSbqqQ3Kqs dS8XBbw26hYntiX1TuaVCe6Tqdk8c5E= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d10b8049 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 14 Jun 2024 18:35:46 +0000 (UTC) Date: Fri, 14 Jun 2024 20:35:38 +0200 From: "Jason A. Donenfeld" To: Michal Hocko Cc: Jann Horn , linux-kernel@vger.kernel.org, patches@lists.linux.dev, tglx@linutronix.de, linux-crypto@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, Greg Kroah-Hartman , Adhemerval Zanella Netto , Carlos O'Donell , Florian Weimer , Arnd Bergmann , Christian Brauner , David Hildenbrand , linux-mm@kvack.org Subject: Re: [PATCH v16 1/5] mm: add VM_DROPPABLE for designating always lazily freeable mappings Message-ID: References: <20240528122352.2485958-1-Jason@zx2c4.com> <20240528122352.2485958-2-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 44EC1140021 X-Stat-Signature: isx5kpr4ihyomyd1nfkqrj8ipzsaznhy X-HE-Tag: 1718390152-145848 X-HE-Meta: U2FsdGVkX1/vIXjKegBs3DHfNeNg0b/aRxvKHjtGz0p1JNwha8491sE+uVEuEzS4U30ES0dtjlmgwnCAuSD4MfiGV8mS/ViKg9HHzjBhG+Cv91Vxa0b2b+rkJfPdpsywS/EPYUGbbJxoo+tbjXin4tkp2yM3rCzKvy8TiCc7BuOzJ1W9Y9e0/Jvjs8uZrvz/UmPvzO2MjzpiHM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ZklOElRt6zA9Ki73p0bjOSOxhGEVmEn+EnFGKIfw2eB5r7tNz4dYmqHQ0YGrtUa7trlvgi2PXnX+vOFbQ28SsL6/n2JVKMMDSX2p5EXyXlz70hSecGAmfvMFp8JUUAVZwn/3mpIVlzsVGbdQZ6RAC6SNV0KR5poWUXDwYO2vsZwZScWhM= 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: On Mon, Jun 10, 2024 at 02:00:21PM +0200, Michal Hocko wrote: > On Fri 07-06-24 17:50:34, Jann Horn wrote: > [...] > > Or, from a different angle: You're trying to allocate memory, and you > > can't make forward progress until that memory has been allocated > > (unless the process is killed). That's what GFP_KERNEL is for. Stuff > > like "__GFP_NOWARN | __GFP_NORETRY" is for when you have a backup plan > > that lets you make progress (perhaps in a slightly less efficient way, > > or by dropping some incoming data, or something like that), and it > > hints to the page allocator that it doesn't have to try hard to > > reclaim memory if it can't find free memory quickly. > > Correct. A psedu-busy wait for allocation to succeed sounds like a very > bad idea to imprint into ABI. Is there really any design requirement to > make these mappings to never cause the OOM killer? > > Making the content dropable under memory pressure because it is > inherently recoverable is something else (this is essentially an > implicit MADV_FREE semantic) but putting a requirement on the memory > allocation on the fault sounds just wrong to me. The idea is that syscall getrandom() won't make a process be killed, so neither should vgetrandom(). But there's an argument to be made that the NOWARN|NORETRY logic only made sense with the now-dropped "skip instruction on fault" patch that was so controversial before, since in that case, there wouldn't be infinite retry, but rather skipping and then falling back to the syscall. I think this is nicer behavior, but the implementation caused a stir, so I'm not at the moment going that route. Given that, I think I'll follow your advice and get rid of NOWARN|NORETRY for this too. And then maybe we'll all revisit that later. Jason