From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757700AbcJZJjT (ORCPT ); Wed, 26 Oct 2016 05:39:19 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:34844 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752282AbcJZJjR (ORCPT ); Wed, 26 Oct 2016 05:39:17 -0400 Date: Wed, 26 Oct 2016 10:39:13 +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 , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: remove unnecessary __get_user_pages_unlocked() calls Message-ID: <20161026093913.GA12814@lucifer> References: <20161025233609.5601-1-lstoakes@gmail.com> <20161025234631.GA5946@lucifer> <20161026091542.GD18382@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161026091542.GD18382@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 On Wed, Oct 26, 2016 at 11:15:43AM +0200, Michal Hocko wrote: > On Wed 26-10-16 00:46:31, Lorenzo Stoakes wrote: > > The holdout for unexporting __get_user_pages_unlocked() is its invocation in > > mm/process_vm_access.c: process_vm_rw_single_vec(), as this definitely _does_ > > seem to invoke VM_FAULT_RETRY behaviour which get_user_pages_remote() will not > > trigger if we were to replace it with the latter. > > I am not sure I understand. Prior to 1e9877902dc7e this used > get_user_pages_unlocked. What prevents us from reintroducing it with > FOLL_REMOVE which was meant to be added by the above commit? > > Or am I missing your point? The issue isn't the flags being passed, rather that in this case: a. Replacing __get_user_pages_unlocked() with get_user_pages_unlocked() won't work as the latter assumes task = current and mm = current->mm but process_vm_rw_single_vec() needs to pass different task, mm. b. Moving to get_user_pages_remote() _will_ allow us to pass different task, mm but won't however match existing behaviour precisely, since __get_user_pages_unlocked() acquires mmap_sem then passes a pointer to a local 'locked' variable to __get_user_pages_locked() which allows VM_FAULT_RETRY to trigger. The main issue I had here was not being sure whether we care about the VM_FAULT_RETRY functionality being used here or not, if we don't care then we can just move to get_user_pages_remote(), otherwise perhaps this should be left alone or maybe we need to consider adjusting the API to allow for remote access with VM_FAULT_RETRY functionality.