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 E808BC433EF for ; Thu, 10 Feb 2022 11:35:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 370D46B0075; Thu, 10 Feb 2022 06:35:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 31FC46B007B; Thu, 10 Feb 2022 06:35:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20E3A6B007D; Thu, 10 Feb 2022 06:35:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 15DA76B0075 for ; Thu, 10 Feb 2022 06:35:23 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B1C3118293B1F for ; Thu, 10 Feb 2022 11:35:22 +0000 (UTC) X-FDA: 79126664484.25.04D51C2 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf25.hostedemail.com (Postfix) with ESMTP id EC47AA000F for ; Thu, 10 Feb 2022 11:35:20 +0000 (UTC) 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-out2.suse.de (Postfix) with ESMTPS id 8FF211F37B; Thu, 10 Feb 2022 11:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1644492919; 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=ANTjimFiWNIfsY0w4OX0/8i+2aewvIuwbua8f0UJFaI=; b=lRmymzO2d51OA3bDvHKy/IPvIcnTe/YIDfHvRvNd2SaAKZl+VxoIMuonUb4MFFQ66D9s79 ew7b9QeF2fJ4LHcXYXtQ+rby0FHOWRQZYDMaa+IMkRt4G5Y4wqSdPEUTmUWa9HVR/c2nU1 AqA0yrEKgoARlY/VpQLy1HOXLZKjN3E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1644492919; 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=ANTjimFiWNIfsY0w4OX0/8i+2aewvIuwbua8f0UJFaI=; b=Cy1VlFzFsoqm953pN7vhg6u7WCNGOP1U4Df40zX0qyJh1yO6f05c8LFuziuiYVEHZHYJ0y T0t6BkinF91SSGAA== 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 57F6913B53; Thu, 10 Feb 2022 11:35:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hCLHFHf4BGKTEgAAMHmgww (envelope-from ); Thu, 10 Feb 2022 11:35:19 +0000 Message-ID: <1699e1b3-0508-4561-a7ec-052f382ca3c8@suse.cz> Date: Thu, 10 Feb 2022 12:35:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Content-Language: en-US To: Hugh Dickins , Andrew Morton Cc: Michal Hocko , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Alistair Popple , Johannes Weiner , Rik van Riel , Suren Baghdasaryan , Yu Zhao , Greg Thelen , Shakeel Butt , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <8e4356d-9622-a7f0-b2c-f116b5f2efea@google.com> <2b5eee76-183f-bd97-2e9d-f5ff8df63db@google.com> From: Vlastimil Babka Subject: Re: [PATCH 02/13] mm/munlock: delete FOLL_MLOCK and FOLL_POPULATE In-Reply-To: <2b5eee76-183f-bd97-2e9d-f5ff8df63db@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: EC47AA000F X-Stat-Signature: 75z9h7qk3841kx9zqg1w9szm4hkah876 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=lRmymzO2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=Cy1VlFzF; dmarc=none; spf=pass (imf25.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam06 X-Rspam-User: X-HE-Tag: 1644492920-477512 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 2/6/22 22:32, Hugh Dickins wrote: > If counting page mlocks, we must not double-count: follow_page_pte() can > tell if a page has already been Mlocked or not, but cannot tell if a pte > has already been counted or not: that will have to be done when the pte > is mapped in (which lru_cache_add_inactive_or_unevictable() already tracks > for new anon pages, but there's no such tracking yet for others). > > Delete all the FOLL_MLOCK code - faulting in the missing pages will do > all that is necessary, without special mlock_vma_page() calls from here. > > But then FOLL_POPULATE turns out to serve no purpose - it was there so > that its absence would tell faultin_page() not to faultin page when > setting up VM_LOCKONFAULT areas; but if there's no special work needed > here for mlock, then there's no work at all here for VM_LOCKONFAULT. > > Have I got that right? I've not looked into the history, but see that > FOLL_POPULATE goes back before VM_LOCKONFAULT: did it serve a different > purpose before? Ah, yes, it was used to skip the old stack guard page. > > And is it intentional that COW is not broken on existing pages when > setting up a VM_LOCKONFAULT area? I can see that being argued either > way, and have no reason to disagree with current behaviour. Yeah I think it's consistent with the two usecases stated for VM_LOCKONFAULT: https://lore.kernel.org/all/1441720742-7803-1-git-send-email-emunson@akamai.com/ > Signed-off-by: Hugh Dickins Acked-by: Vlastimil Babka