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 5C4B8C54EBD for ; Thu, 12 Jan 2023 11:04:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A6ACC8E0002; Thu, 12 Jan 2023 06:04:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A1B3B8E0001; Thu, 12 Jan 2023 06:04:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E2A98E0002; Thu, 12 Jan 2023 06:04:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7FAF58E0001 for ; Thu, 12 Jan 2023 06:04:57 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 326C340757 for ; Thu, 12 Jan 2023 11:04:57 +0000 (UTC) X-FDA: 80345864634.15.57E568B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf22.hostedemail.com (Postfix) with ESMTP id 4FA41C000D for ; Thu, 12 Jan 2023 11:04:55 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=NcYnuvit; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="iJw2x/cg"; spf=pass (imf22.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673521495; a=rsa-sha256; cv=none; b=IwdbgCqccoKC3T/cwzk5baCN4euP0m7N82+J4V4xFNA7ARzPu86zyXKVFWin0CE3U3vPfO wmop3RT1/NJeDHn9WwavDiNjTb/PhgyzT34dgBPSvDB5un0VsD4RqKjl4PqUi9apH1tu5t 6E6vEamwub/3FtrVV/Jed3SKeZeVk+Q= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=NcYnuvit; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="iJw2x/cg"; spf=pass (imf22.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673521495; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=e7U4mlN6IF/k21gP9LsSqfR9yyrjT6JH4Uv/UCYlR+E=; b=hyZsIvsl+yiQBBCZusVy3e5E23xvf7WvdgHIj/MyURA70GmEl+6pgFrmkpjs/jGCXuekMD xGoNO5LH5tB70kbp8VqcyiFsYT1qd1/kW84SmN/0r8OIRr0wNbr+Mh7jU8fULHdqU/X8uX v2lQ3XCBXEVuIKsJ7J2zeiFdx4dOwTM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 83A2F3EB52; Thu, 12 Jan 2023 11:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673521493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e7U4mlN6IF/k21gP9LsSqfR9yyrjT6JH4Uv/UCYlR+E=; b=NcYnuvitptmAuez2XBj6nEOXLq9D+CPypAeb3HxFZtXul03DiOfpAFiCpFSw3OWFMAWoqJ Bpgfk1bqPYQb1eBfK9cT+s3HNe8eZ8Rlm1hJEybRDUJxp9lExiv9lIMcUBKJpc6TwnpaQJ 3Y1zt2DxwjbfByhG5hCN3ziZBZFZg6U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673521493; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e7U4mlN6IF/k21gP9LsSqfR9yyrjT6JH4Uv/UCYlR+E=; b=iJw2x/cgJd7Laxrc+uU9MXmqgSZavie4T/1g9g3jzcRn+GPwW0oL79NJUzGJGyrLZ4i2JX rDF5+smmKecxrdBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4E73313776; Thu, 12 Jan 2023 11:04:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VwNtElXpv2N/MAAAMHmgww (envelope-from ); Thu, 12 Jan 2023 11:04:53 +0000 Message-ID: Date: Thu, 12 Jan 2023 12:04:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v3 5/5] Documentation/mm: Update references to __m[un]lock_page() to *_folio() Content-Language: en-US To: Lorenzo Stoakes , linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Hugh Dickins , Liam Howlett , William Kucharski , Christian Brauner , Jonathan Corbet , Mike Rapoport , Joel Fernandes , Geert Uytterhoeven References: From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Queue-Id: 4FA41C000D X-Rspamd-Server: rspam01 X-Stat-Signature: rcx1itfkokms77mgkehy4qeuc458kpaq X-HE-Tag: 1673521495-44459 X-HE-Meta: U2FsdGVkX19V+jpHqyuPsxBl/91M1/uY8KrqPJdq1qUfzVADYY55Rc7CrF6jY3vLBOuTaWTiKEm7DuR0TQaGxBSd9FKTy/iCjG5JfYvTTUJCI1PVa+XA8GKZ5e5/Ul6HI5I/NB/h9G/5EpjiSLG8K12Qm3znEyApgLTgmB10fnGKZN2WqrI89Bu5g9NhVGB0PbJrLjK45ODcJgwPsyf4ScWKv3A5XaX7NDxhJqTRtVxXzVNJJDOk40d3QRGfZbQKeds6yp6c10uFWfn0208Fl+mx9uVx/Ri2f2y6nvF78zLiDazCOal9aT/JXET0Pt57CMCWjUVtmngpTIV/F9KZs8wlIkvzoIBKV2KwcW1qet6h8+pAVQo91S/M7TNTJ5QB9GlxYFtvfaoVeiK5YdzDbDYq7SeNBIVRzNurxo1eP4qLlDySdkxf2XB9NXmlKbr/DFeNyOKd0W3UaHNRVjUsXbGHLqqVOyHavojjlcw0BS8A4KsxdPual5XQ7mqlXDRykMApXoxF8nFH7H965FHLO9oAf4EBhsLkk9AqoTED+kWzi7w7ALodQPo9yAI0j/Db8a50Ks6Xx6fn7TI8gD/GyxE3+/vYoEB7tNCxLXG63hRpb+rVD7Jbl11Qe8xBGZwNECHVhOCFrYmgTxRvUFnebjb4e1yMZrL2WYd2oS2gRsKRSJTdYx9Mnn4/0U9OZt+tfxmhNMWtkDjTLZ4sxObJgkg5jlfRfty3dpOsAXceQr18hNuFhBKuiEoTuY5a0MhJ2TOGY3unEEyGa0vJSHLJp6teFIFRdAwhc+RpgCZd+80Q4nuKUULn1Zs0QRh0irlfG4SBPpM7CUIj9qR0t/4npaxhJzykbCEsUHUJlj5nSXjMAsFhZ3NX3PalO8olNHm48yNFSzKroanYFNemdhU4B+0dcFfNJVVkkWC+0hXttf72BD451MEbMTCKty8MvLbrK5uleYRFPqTQCV+ajnS N+w== 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 12/26/22 09:44, Lorenzo Stoakes wrote: > We now pass folios to these functions, so update the documentation > accordingly. > > Additionally, correct the outdated reference to __pagevec_lru_add_fn(), the > referenced action occurs in __munlock_folio() directly now. > > Signed-off-by: Lorenzo Stoakes Acked-by: Vlastimil Babka With: > --- > Documentation/mm/unevictable-lru.rst | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/Documentation/mm/unevictable-lru.rst b/Documentation/mm/unevictable-lru.rst > index 4a0e158aa9ce..153629e0c100 100644 > --- a/Documentation/mm/unevictable-lru.rst > +++ b/Documentation/mm/unevictable-lru.rst > @@ -308,22 +308,22 @@ do end up getting faulted into this VM_LOCKED VMA, they will be handled in the > fault path - which is also how mlock2()'s MLOCK_ONFAULT areas are handled. > > For each PTE (or PMD) being faulted into a VMA, the page add rmap function > -calls mlock_vma_page(), which calls mlock_page() when the VMA is VM_LOCKED > +calls mlock_vma_page(), which calls mlock_folio() when the VMA is VM_LOCKED > (unless it is a PTE mapping of a part of a transparent huge page). Or when > it is a newly allocated anonymous page, lru_cache_add_inactive_or_unevictable() Think it would be more appropriate now: ^ folio_add_lru_vma() > -calls mlock_new_page() instead: similar to mlock_page(), but can make better > +calls mlock_new_folio() instead: similar to mlock_folio(), but can make better > judgments, since this page is held exclusively and known not to be on LRU yet. > > -mlock_page() sets PageMlocked immediately, then places the page on the CPU's PG_mlocked? > -mlock pagevec, to batch up the rest of the work to be done under lru_lock by > -__mlock_page(). __mlock_page() sets PageUnevictable, initializes mlock_count PG_unevictable ditto below > +mlock_folio() sets PageMlocked immediately, then places the page on the CPU's > +mlock folio batch, to batch up the rest of the work to be done under lru_lock by > +__mlock_folio(). __mlock_folio() sets PageUnevictable, initializes mlock_count > and moves the page to unevictable state ("the unevictable LRU", but with > mlock_count in place of LRU threading). Or if the page was already PageLRU > and PageUnevictable and PageMlocked, it simply increments the mlock_count. > > But in practice that may not work ideally: the page may not yet be on an LRU, or > it may have been temporarily isolated from LRU. In such cases the mlock_count > -field cannot be touched, but will be set to 0 later when __pagevec_lru_add_fn() > +field cannot be touched, but will be set to 0 later when __munlock_folio() > returns the page to "LRU". Races prohibit mlock_count from being set to 1 then: > rather than risk stranding a page indefinitely as unevictable, always err with > mlock_count on the low side, so that when munlocked the page will be rescued to