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 253B9C433EF for ; Wed, 9 Feb 2022 21:01:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71CF46B0074; Wed, 9 Feb 2022 16:01:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CC0D6B0075; Wed, 9 Feb 2022 16:01:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 594566B0078; Wed, 9 Feb 2022 16:01:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 495956B0074 for ; Wed, 9 Feb 2022 16:01:29 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 08E03998E2 for ; Wed, 9 Feb 2022 21:01:29 +0000 (UTC) X-FDA: 79124462298.30.17DBB78 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf14.hostedemail.com (Postfix) with ESMTP id 5A61610000F for ; Wed, 9 Feb 2022 21:01:28 +0000 (UTC) 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> Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="dL/717QM"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf14.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspamd-Server: rspam03 X-Rspam-User: X-Stat-Signature: cuybxfa43hhxup9j6yecextrm8b54knh X-Rspamd-Queue-Id: 5A61610000F X-HE-Tag: 1644440488-84263 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 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