Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6400952ybh; Wed, 7 Aug 2019 23:24:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3+rUFVQ5lcAoYRGVUEaxkTIM1FnXjEt/q8vWzLAB86dmfzYoHcyJfRHO+rGXL3xQXVkQb X-Received: by 2002:a63:e010:: with SMTP id e16mr11092933pgh.285.1565245496969; Wed, 07 Aug 2019 23:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565245496; cv=none; d=google.com; s=arc-20160816; b=nkW+wV3POEXn4U7ehKXzA0RtXVjGUkkuG1WdAZ42sQUrQOwZDEoUK7du9GbC//BJDc U0Sv3rcfBT3VdN26TGB8qMcJoOH5Eq8/XH72arNRgXFF0wQ21OPX3RHGHS3XlybSHw5O 0Mr+uSq14PKq66uDnYIRCKkEoPhR2gIrRnYqtdsmj91La0hv8+Xlk/+JgJTKcoyFcreo GB5GMV9fP7gwAH7+a8aLctKFai0kDnlHLE7oOn5RKFadsEqazKxlMaRN0BsDIb4JaFam P0JTIcOTdlUAcyvpSNehfkPM4ZJPSDepdhh+PpLMR/Ho6sdavb44gz4QFsAJKJ7FeT0z tfBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yYtKGAMPjoXjqo32/hmcOOi7aPq8QaatA1uJ9Rtg46M=; b=illuLMuJsSdwHk7KLpL21Hc4s6JxDA2Z+5i/pGwD2tZlt6YZtZypD13ngvyZxGJ/lV WiWF/ZakU8ydAdpYF/St1Oj3rwDjZj18J15+8EpgdW9ikAqrZfIqSx6JISIwQL4nCitn MnzyvR+HNPbbZZTLfLqeY6KGIZu14avysmO5ouW3wa3gSIYqqehnBGGek7Ml24Qm+sr7 8vpB4N8nSioHBaOw8lIIzDUvj9WwvGi0LYJIqOCR5jMCy5iWqYL1N7iGNpxwW5dTbfjO txeCfnvldocmiiaecTNlN8JDD6nru2edoXc/ClhSAKrZMkae6a8NdSio+l7v+aZtY5DK IklQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15si50384514pgy.517.2019.08.07.23.24.41; Wed, 07 Aug 2019 23:24:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731224AbfHHGV7 (ORCPT + 99 others); Thu, 8 Aug 2019 02:21:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:35042 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731005AbfHHGV6 (ORCPT ); Thu, 8 Aug 2019 02:21:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4FE4DAF37; Thu, 8 Aug 2019 06:21:57 +0000 (UTC) Date: Thu, 8 Aug 2019 08:21:55 +0200 From: Michal Hocko To: John Hubbard Cc: john.hubbard@gmail.com, Andrew Morton , Christoph Hellwig , Ira Weiny , Jan Kara , Jason Gunthorpe , Jerome Glisse , LKML , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Dan Williams , Daniel Black , Matthew Wilcox , Mike Kravetz Subject: Re: [PATCH 1/3] mm/mlock.c: convert put_page() to put_user_page*() Message-ID: <20190808062155.GF11812@dhcp22.suse.cz> References: <20190805222019.28592-1-jhubbard@nvidia.com> <20190805222019.28592-2-jhubbard@nvidia.com> <20190807110147.GT11812@dhcp22.suse.cz> <01b5ed91-a8f7-6b36-a068-31870c05aad6@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01b5ed91-a8f7-6b36-a068-31870c05aad6@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 07-08-19 16:32:08, John Hubbard wrote: > On 8/7/19 4:01 AM, Michal Hocko wrote: > > On Mon 05-08-19 15:20:17, john.hubbard@gmail.com wrote: > >> From: John Hubbard > >> > >> For pages that were retained via get_user_pages*(), release those pages > >> via the new put_user_page*() routines, instead of via put_page() or > >> release_pages(). > > > > Hmm, this is an interesting code path. There seems to be a mix of pages > > in the game. We get one page via follow_page_mask but then other pages > > in the range are filled by __munlock_pagevec_fill and that does a direct > > pte walk. Is using put_user_page correct in this case? Could you explain > > why in the changelog? > > > > Actually, I think follow_page_mask() gets all the pages, right? And the > get_page() in __munlock_pagevec_fill() is there to allow a pagevec_release() > later. Maybe I am misreading the code (looking at Linus tree) but munlock_vma_pages_range calls follow_page for the start address and then if not THP tries to fill up the pagevec with few more pages (up to end), do the shortcut via manual pte walk as an optimization and use generic get_page there. -- Michal Hocko SUSE Labs