Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932750AbdCGPVQ (ORCPT ); Tue, 7 Mar 2017 10:21:16 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35757 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755432AbdCGPTU (ORCPT ); Tue, 7 Mar 2017 10:19:20 -0500 Date: Tue, 7 Mar 2017 18:17:47 +0300 From: "Kirill A. Shutemov" To: Minchan Kim Cc: Andrew Morton , kernel-team@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Vlastimil Babka , "Kirill A . Shutemov" Subject: Re: [RFC 05/11] mm: make the try_to_munlock void function Message-ID: <20170307151747.GA2940@node.shutemov.name> References: <1488436765-32350-1-git-send-email-minchan@kernel.org> <1488436765-32350-6-git-send-email-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1488436765-32350-6-git-send-email-minchan@kernel.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 890 Lines: 27 On Thu, Mar 02, 2017 at 03:39:19PM +0900, Minchan Kim wrote: > try_to_munlock returns SWAP_MLOCK if the one of VMAs mapped > the page has VM_LOCKED flag. In that time, VM set PG_mlocked to > the page if the page is not pte-mapped THP which cannot be > mlocked, either. > > With that, __munlock_isolated_page can use PageMlocked to check > whether try_to_munlock is successful or not without relying on > try_to_munlock's retval. It helps to make ttu/ttuo simple with > upcoming patches. I *think* you're correct, but it took time to wrap my head around. We basically rely on try_to_munlock() never caller for PTE-mapped THP. And we don't at the moment. It worth adding something like VM_BUG_ON_PAGE(PageCompound(page) && PageDoubleMap(page), page); into try_to_munlock(). Otherwise looks good to me. Will free adding my Acked-by once this nit is addressed. -- Kirill A. Shutemov