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 7F23BC3271E for ; Thu, 11 Jul 2024 04:32:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92EC06B007B; Thu, 11 Jul 2024 00:32:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DE246B0082; Thu, 11 Jul 2024 00:32:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A5AE6B0083; Thu, 11 Jul 2024 00:32:41 -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 5B41D6B007B for ; Thu, 11 Jul 2024 00:32:41 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C691D403A0 for ; Thu, 11 Jul 2024 04:32:40 +0000 (UTC) X-FDA: 82326200880.01.D796817 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf07.hostedemail.com (Postfix) with ESMTP id 9160F40020 for ; Thu, 11 Jul 2024 04:32:38 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b="hK6/BNkb"; spf=pass (imf07.hostedemail.com: domain of "SRS0=Le2v=OL=zx2c4.com=Jason@kernel.org" designates 145.40.73.55 as permitted sender) smtp.mailfrom="SRS0=Le2v=OL=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=1720672326; 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=bUM3Y4D20BWlPnBgrUFDE9T3dbKAyxe2+cRLVwadkjE=; b=7sWJp27Uvxr21/nYRZHNFM7V2ngQzCWv+F38k+T0ouOngP+utBRrpW9kzgTdRHLehdAlCi DsnpK+JdkITaSusycGzfygdf0/oj+GKdswNOZuzM7jxlmd0Z1hm73UGNNdhJTs/GbU+JHg uposbHTVfY5LNpTVsyIfOjjdLSC7StU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720672326; a=rsa-sha256; cv=none; b=W+1GtLLaraJ6ZBhnQDqPlFBD9Dq52sKpXv0Ap0eZCb7kcY8c7doDxKLP9M7QYCpDD+z3SP dhvXyBqRl+6PZZBwQJAt5ZQWV3ciQlX03uwTcrM64xzvKFaHSxrq6Y5PSkCpixLRpnqih9 iFGjdKjtFX3YXbc80jQqEI/sl8HCBe8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b="hK6/BNkb"; spf=pass (imf07.hostedemail.com: domain of "SRS0=Le2v=OL=zx2c4.com=Jason@kernel.org" designates 145.40.73.55 as permitted sender) smtp.mailfrom="SRS0=Le2v=OL=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 sin.source.kernel.org (Postfix) with ESMTP id 38961CE0B2D; Thu, 11 Jul 2024 04:32:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC670C116B1; Thu, 11 Jul 2024 04:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1720672351; 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=bUM3Y4D20BWlPnBgrUFDE9T3dbKAyxe2+cRLVwadkjE=; b=hK6/BNkbjum1DdKhPbNaqS+k6MZP/K0HHkkVrVh2FOZaI9BTUGc8N9R3fJyjk1bY3L3/oQ mBJ2DOBMKD1ZCZLey6e8H38+z4FWQ+CowlExwdglfmBzvOHeWg7GWEG1CiJcyFv+hFueg1 J7XZBZBxrAykIOV8BoMokWlCcLtv3w0= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 36f7f89a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 11 Jul 2024 04:32:30 +0000 (UTC) Date: Thu, 11 Jul 2024 06:32:28 +0200 From: "Jason A. Donenfeld" To: David Hildenbrand Cc: 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, Linus Torvalds , Greg Kroah-Hartman , Adhemerval Zanella Netto , Carlos O'Donell , Florian Weimer , Arnd Bergmann , Jann Horn , Christian Brauner , David Hildenbrand , linux-mm@kvack.org Subject: Re: [PATCH v22 1/4] mm: add MAP_DROPPABLE for designating always lazily freeable mappings Message-ID: References: <20240709130513.98102-1-Jason@zx2c4.com> <20240709130513.98102-2-Jason@zx2c4.com> <378f23cb-362e-413a-b221-09a5352e79f2@redhat.com> <9b400450-46bc-41c7-9e89-825993851101@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Stat-Signature: x7ptmmm4i3h7jx9tfhfrn8iscmwimhgh X-Rspamd-Queue-Id: 9160F40020 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1720672358-79708 X-HE-Meta: U2FsdGVkX19TvyQ0ot37FtwH3u40Jo5ak3BxRKHu9OGuTWRicleG2t0dkST+2f5Y6Xl48UIdQtGCCWBhnAQyfnjlcPXqfLZ2nRYXptasFhgRYeCeCtLUWPVx+a+jd5Uy7RdZtS8mAs1zRpEcX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+ciflEjF76eDePMIMFOCRdKsTBfUZC/PFUVYInykh/BwylTaTYlnSyWeyWzhYHJ6fiqmdFIUMuUugyzMoLFkmHrplX+NEM7phVVJ3oInXnh1g9+JZ/pGcSO+YjZkVN2lURrBtRw5QPMow85TOiMcdEYwAR10amJL/CHq6/XHKTauFcR+ZbnKj5GAXyG/shktprPvxXbAURwpN540D6CTIpwCXuNNvUOY7RGkhU= 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 Thu, Jul 11, 2024 at 02:44:29AM +0200, Jason A. Donenfeld wrote: > Hi David, > > On Wed, Jul 10, 2024 at 06:05:34AM +0200, David Hildenbrand wrote: > > BTW, do we have to handle the folio_set_swapbacked() in sort_folio() as well? > > > > > > /* dirty lazyfree */ > > if (type == LRU_GEN_FILE && folio_test_anon(folio) && folio_test_dirty(folio)) { > > success = lru_gen_del_folio(lruvec, folio, true); > > VM_WARN_ON_ONCE_FOLIO(!success, folio); > > folio_set_swapbacked(folio); > > lruvec_add_folio_tail(lruvec, folio); > > return true; > > } > > > > Maybe more difficult because we don't have a VMA here ... hmm > > > > IIUC, we have to make sure that no folio_set_swapbacked() would ever get > > performed on these folios, correct? > > Hmmm, I'm trying to figure out what to do here, and if we have to do > something. All three conditions in that if statement will be true for a > folio in a droppable mapping. That's supposed to match MADV_FREE > mappings. > > What is the context of this, though? It's scanning pages for good ones > to evict into swap, right? So if it encounters one that's an MADV_FREE > page, it actually just wants to delete it, rather than sending it to > swap. So it looks like it does just that, and then sets the swapbacked > bit back to true, in case the folio is used for something differnet > later? > > If that's correct, then I don't think we need to do anything for this > one. > > If that's not correct, then we'll need to propagate the droppableness > to the folio level. But hopefully we don't need to do that. Looks like that's not correct. This is for pages that have been dirtied since calling MADV_FREE. So, hm.