Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932637AbbGUPgI (ORCPT ); Tue, 21 Jul 2015 11:36:08 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47173 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754817AbbGUPgF (ORCPT ); Tue, 21 Jul 2015 11:36:05 -0400 Message-ID: <55AE66DF.1060600@suse.cz> Date: Tue, 21 Jul 2015 17:35:59 +0200 From: Vlastimil Babka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Eric B Munson , Jonathan Corbet CC: Andrew Morton , Michal Hocko , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH V3 3/5] mm: mlock: Introduce VM_LOCKONFAULT and add mlock flags to enable it References: <1436288623-13007-1-git-send-email-emunson@akamai.com> <1436288623-13007-4-git-send-email-emunson@akamai.com> <20150708132351.61c13db6@lwn.net> <20150708203456.GC4669@akamai.com> <20150708151750.75e65859@lwn.net> <20150709184635.GE4669@akamai.com> <20150710101118.5d04d627@lwn.net> <20150710161948.GF4669@akamai.com> In-Reply-To: <20150710161948.GF4669@akamai.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1936 Lines: 45 On 07/10/2015 06:19 PM, Eric B Munson wrote: > On Fri, 10 Jul 2015, Jonathan Corbet wrote: > >> On Thu, 9 Jul 2015 14:46:35 -0400 >> Eric B Munson wrote: >> >>>> One other question...if I call mlock2(MLOCK_ONFAULT) on a range that >>>> already has resident pages, I believe that those pages will not be locked >>>> until they are reclaimed and faulted back in again, right? I suspect that >>>> could be surprising to users. >>> >>> That is the case. I am looking into what it would take to find only the >>> present pages in a range and lock them, if that is the behavior that is >>> preferred I can include it in the updated series. >> >> For whatever my $0.02 is worth, I think that should be done. Otherwise >> the mlock2() interface is essentially nondeterministic; you'll never >> really know if a specific page is locked or not. >> >> Thanks, >> >> jon > > Okay, I likely won't have the new set out today then. This change is > more invasive. IIUC, I need an equivalent to __get_user_page() skips > pages which are not present instead of faulting in and the call chain to > get to it. Unless there is an easier way that I am missing. IIRC having page PageMlocked and put on unevictable list isn't necessary to prevent it from being reclaimed. It's just to prevent it from being scanned for reclaim in the first place. When attempting to unmap the page, vma flags are still checked, see the code in try_to_unmap_one(). You should probably extend the checks to your new VM_ flag as it is done for VM_LOCKED and then you shouldn't need to walk the pages to mlock them (although it would probably still be better for the accounting accuracy). > Eric > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/