Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2303414pxb; Wed, 9 Feb 2022 15:38:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrXDkC8lXHkTXJ7GUdlZdAjOUJx1vyDGNo9nta0AJZC//TDHEQHJVEfB23jwroQ4VPoe/W X-Received: by 2002:a05:6a00:2183:: with SMTP id h3mr4797542pfi.12.1644449928665; Wed, 09 Feb 2022 15:38:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644449928; cv=none; d=google.com; s=arc-20160816; b=zPqUJ6zXcSILNirCj4ZEONqHPJWPGuwGv39Wpr7608BpV++JCas0MzPOCTpA12S/FK x0J7cNlun/xrDUGrGL9+8P+EJtZzPojR+fSZBh1lBvT+lyOVxFoVIChBkWdyWGlQSJAK hNqQfb3yu5FPZY3qBvk7EDQFJno05OWfanEcyqX8JfVqhHD6mNwxGtraSNxfML4ny8/G EKuUedRi+fpmTysi+SUA6dlwWu+3VFbtk8374AkOK8eEPEoesXWOUx5hxyVTuJ4GTR8D G5iWes5yRTpA+kU08+ueAi5wQ6h6Q6Y5geBwcDyR7hn8jyx5lo1z9MOVUtNtDNM8TlJS wBxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q81KcrINMylJ5+uqns4dLh+8xUMp5QZhdKl6MCEbW1k=; b=WhGPkbChlKgcHGgzZE9oc9KBQzZNDixeNKxngh5ERYooisQl/PFujOjRliynYcd6lv teYZIDVEiMST3U1rxwbKXR8UzKMU7CF4WQ68eMTDn6RHqpmXQX4YBw8EZYYbOIbjNTOn gin3KH15jbeBNBhvExlx3dcFBV/aztfC8aw5n7hVSrHdX1bGjPMWgIMsniU2ebwCB6JF ba/mTrRYQb9IH3PIutI9CU0SH7C21VJa9YXHAgYecmRgFWzst4MPU1mcBjnvNSiLkFfW w8sFX44tXfClQT1XeRHdfN8XIIsdKqOck5Vw2ZPLiU1o7aRxqFekkcS+rlHc6bHnLo7g rnQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="dL/717QM"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l190si3745590pgd.522.2022.02.09.15.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 15:38:48 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="dL/717QM"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C9D8E08D8E7; Wed, 9 Feb 2022 15:24:14 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232681AbiBIVB2 (ORCPT + 99 others); Wed, 9 Feb 2022 16:01:28 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232649AbiBIVB0 (ORCPT ); Wed, 9 Feb 2022 16:01:26 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37A93C035440 for ; Wed, 9 Feb 2022 13:01:28 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E99B01F391; Wed, 9 Feb 2022 21:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1644440486; h=from:from:reply-to: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=Q81KcrINMylJ5+uqns4dLh+8xUMp5QZhdKl6MCEbW1k=; b=dL/717QMasiax5WptP9WIZqCthi3hg7YFDjvRxMgPhkMMq49Ib72b2hF5RalmEYbo1+uNa C3CW4D6/qwm/vZOnCBfft2n3GNXbf5JLSyYV9fpwk2vCAz9lLo+2Qfx8+QN/HzFeFjhktY +ePf7Jnz/1cUmTbfpv/8NKk5eazJnCk= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9B9BBA3B84; Wed, 9 Feb 2022 21:01:26 +0000 (UTC) Date: Wed, 9 Feb 2022 22:01:24 +0100 From: Michal Hocko To: Hugh Dickins Cc: Andrew Morton , Vlastimil Babka , "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 Subject: Re: [PATCH 00/13] mm/munlock: rework of mlock+munlock page handling Message-ID: References: <8e4356d-9622-a7f0-b2c-f116b5f2efea@google.com> <147388c6-eb7-5c58-79a-7a8279c27fd@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <147388c6-eb7-5c58-79a-7a8279c27fd@google.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed 09-02-22 08:21:17, Hugh Dickins wrote: > On Wed, 9 Feb 2022, Michal Hocko wrote: [...] > > The only thing that is not entirely clear to me at the moment is why you > > have chosen to ignore already mapped LOCKONFAULT pages. They will > > eventually get sorted out during the reclaim/migration but this can > > backfire if too many pages have been pre-faulted before LOCKONFAULT > > call. Maybe not an interesting case in the first place but I am still > > wondering why you have chosen that way. > > I'm puzzled: what makes you think I'm ignoring already mapped LOCKONFAULT > pages? I'd consider that a bug. I've had the following path in mind __mm_populate populate_vma_page_range if (vma->vm_flags & VM_LOCKONFAULT) return nr_page which means that __get_user_pages is not called at all. This also means that follow_page_mask is skipped. The page table walk used to mark already mapped pages as mlocked so unless I miss some other path it would stay on its original LRU list and only get real mlock protection when encountered by the reclaim or migration. > It is the case, isn't it, that a VM_LOCKONFAULT area always has VM_LOCKED > set too? If I've got that wrong, yes, I'll need to revisit conditions. Yes, I did't really mean we would lose the mlock protection. We would just do the lazy mlock also on pages which are already mapped. This is certainly not a correctness issue - althoug stats might be off - but it could polute existing LRUs with mlocked pages rather easily. As I've said. Either I am still missing something or this might even not be a big deal in real life. I was mostly curious about the choice to exclude the page table walk for LOCKONFAULT. -- Michal Hocko SUSE Labs