Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2724472pxb; Thu, 10 Feb 2022 04:17:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2SI1Ec9vENHgpmg9SR3+Rd8Ok5ncQsH+PAm/B4BnvOTnyQyegvZfnqUMBVyeMdSpRUkxo X-Received: by 2002:a17:90b:3882:: with SMTP id mu2mr2554462pjb.150.1644495421920; Thu, 10 Feb 2022 04:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644495421; cv=none; d=google.com; s=arc-20160816; b=cSa/PtQ1LXncF/G+fegr6FoaZZlUMU2xmdN4gygx86u7Dd1v48qqHYfRCr3sjuNsIX wZwiySyLWUrncUUxg5aV5+4invcSaaAn7jkz00li/PzWtjKYPbG6NtgUIRlxno5l+5F9 FZdG418fzP7AmTI9lp6bv6cQSWKkyLMacgVRu3dvTo31lEDWgSa/T/GKbX6SSGwMXIDT 8l05FOy2ufag7m86hu1E3DWGyL1X9bXqko7fR5miondCzC21dLQgaCsTCijevkmxI3Y0 XoM9isvlVKGOCmodLCt2qkHXKZRx0qNWs/u5FZB7I4cOoF9Umm1TdF4SAXvZnaSWJ9ME Ovcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=ANTjimFiWNIfsY0w4OX0/8i+2aewvIuwbua8f0UJFaI=; b=D/COWdsGfFAYS+2Y0RFytSg88x4spIF5CWcJOoF0mOK5dRWauHCcyFxs9okWfk9ZfL 6M1tzs0SpUAJJVWa1WoUVa2vS+6d6ZogyOnwEbgGSXzufuOamH31gSjsQp0DU08uaOnv oXyqLykQ5umETqb9aZPEkwzFKWHF728oFVfDVcKYU/uXoVXNDHXT5YhGd43niAEgzetm fvGLuXwGwF7oH85nGq8izzPKfJo5YokafPdon9klImIWjxzjNJUJuKLVeLzpz86RG2xM vpKlPxExlJ4rZPco+oRdQyEnqy+MbMzf5QKFo56iNHTLsmVYmBgdtvSQj85bKFEuUUhN 21JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=lRmymzO2; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8si1191831pfc.280.2022.02.10.04.16.40; Thu, 10 Feb 2022 04:17:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=lRmymzO2; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240998AbiBJLfV (ORCPT + 99 others); Thu, 10 Feb 2022 06:35:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235635AbiBJLfU (ORCPT ); Thu, 10 Feb 2022 06:35:20 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4AC61001 for ; Thu, 10 Feb 2022 03:35:20 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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