Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756902AbcJZI6j (ORCPT ); Wed, 26 Oct 2016 04:58:39 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33771 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753319AbcJZI4G (ORCPT ); Wed, 26 Oct 2016 04:56:06 -0400 Date: Wed, 26 Oct 2016 09:55:47 +0100 From: Lorenzo Stoakes To: Michal Hocko Cc: linux-mm@kvack.org, Linus Torvalds , Jan Kara , Hugh Dickins , Dave Hansen , Rik van Riel , Mel Gorman , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/10] mm: adjust get_user_pages* functions to explicitly pass FOLL_* flags Message-ID: <20161026085547.GA3737@lucifer> References: <20161013002020.3062-1-lstoakes@gmail.com> <20161018153050.GC13117@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161018153050.GC13117@dhcp22.suse.cz> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1516 Lines: 28 On Tue, Oct 18, 2016 at 05:30:50PM +0200, Michal Hocko wrote: >I am wondering whether we can go further. E.g. it is not really clear to >me whether we need an explicit FOLL_REMOTE when we can in fact check >mm != current->mm and imply that. Maybe there are some contexts which >wouldn't work, I haven't checked. > >Then I am also wondering about FOLL_TOUCH behavior. >__get_user_pages_unlocked has only few callers which used to be >get_user_pages_unlocked before 1e9877902dc7e ("mm/gup: Introduce >get_user_pages_remote()"). To me a dropped FOLL_TOUCH seems >unintentional. Now that get_user_pages_unlocked has gup_flags argument I >guess we might want to get rid of the __g-u-p-u version altogether, no? > >__get_user_pages is quite low level and imho shouldn't be exported. It's >only user - kvm - should rather pull those two functions to gup instead >and export them. There is nothing really KVM specific in them. I believe I've attacked each of these, other than the use of explicit FOLL_REMOTE which was explained by Dave. > I also cannot say I would be entirely thrilled about get_user_pages_locked, > we only have one user which can simply do lock g-u-p unlock AFAICS. The principle difference here seems to be the availability of VM_FAULT_RETRY behaviour (by passing a non-NULL locked argument), and indeed the comments in gup.c recommends using get_user_pages_locked() if possible (though it seems not to have been heeded too much :), so I'm not sure if this would be a fruitful refactor, let me know!