From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com [209.85.216.54]) by kanga.kvack.org (Postfix) with ESMTP id 1873F6B0037 for ; Sat, 10 May 2014 20:48:41 -0400 (EDT) Received: by mail-qa0-f54.google.com with SMTP id j15so5544321qaq.41 for ; Sat, 10 May 2014 17:48:40 -0700 (PDT) Received: from mail-qa0-x229.google.com (mail-qa0-x229.google.com [2607:f8b0:400d:c00::229]) by mx.google.com with ESMTPS id h90si4078873qgh.183.2014.05.10.17.48.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 10 May 2014 17:48:40 -0700 (PDT) Received: by mail-qa0-f41.google.com with SMTP id dc16so5683420qab.0 for ; Sat, 10 May 2014 17:48:40 -0700 (PDT) Date: Sat, 10 May 2014 20:48:31 -0400 From: Jerome Glisse Subject: Re: [RFC] Heterogeneous memory management (mirror process address space on a device mmu). Message-ID: <20140511004829.GA7101@gmail.com> References: <20140506102925.GD11096@twins.programming.kicks-ass.net> <20140506150014.GA6731@gmail.com> <20140506153315.GB6731@gmail.com> <20140506161836.GC6731@gmail.com> <1399446892.4161.34.camel@pasglop> <20140509012601.GA2906@gmail.com> <1399696115.4481.48.camel@pasglop> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1399696115.4481.48.camel@pasglop> Sender: owner-linux-mm@kvack.org List-ID: To: Benjamin Herrenschmidt Cc: Linus Torvalds , Peter Zijlstra , linux-mm , Linux Kernel Mailing List , linux-fsdevel , Mel Gorman , "H. Peter Anvin" , Andrew Morton , Linda Wang , Kevin E Martin , Jerome Glisse , Andrea Arcangeli , Johannes Weiner , Larry Woodman , Rik van Riel , Dave Airlie , Jeff Law , Brendan Conoboy , Joe Donohue , Duncan Poole , Sherry Cheung , Subhash Gutti , John Hubbard , Mark Hairgrove , Lucien Dunning , Cameron Buschardt , Arvind Gopalakrishnan , Haggai Eran , Or Gerlitz , Sagi Grimberg , Shachar Raindel , Liran Liss , Roland Dreier , "Sander, Ben" , "Stoner, Greg" , "Bridgman, John" , "Mantor, Michael" , "Blinzer, Paul" , "Morichetti, Laurent" , "Deucher, Alexander" , "Gabbay, Oded" , Davidlohr Bueso On Sat, May 10, 2014 at 02:28:35PM +1000, Benjamin Herrenschmidt wrote: > On Thu, 2014-05-08 at 21:26 -0400, Jerome Glisse wrote: > > Otherwise i have no other choice than to add something like mmu_notifier > > in the place where there can a be race (huge page split, cow, ...). Which > > sounds like a bad idea to me when mmu_notifier is perfect for the job. > > Even there, how are you going to find a sleepable context ? All that stuff > has the PTL held. > > Cheers, > Ben. All i need is invalidate_page and invalidate_range_start both of which are not call while holding any lock beside that anon_vma and or mmap_sem. So i am fine on that front. The change_pte callback are bracketed by call to invalidate_range_start / end. What is important is to flush GPU page table prior to any update that would make the cpu page table point to a different page. For invalidate_page this is ok because so far it is call either as page reclaimation and those page is change to swap entry or file entry. Or it is call for page migration and cpu page table is set to special migration entry (there is also the memory failure case but this one is harmless too). So as far as i can tell i am safe on that front and only mmu_notifier provide the early warning that i need notably for COW. Cheers, Jerome -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org