Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp113281pxx; Tue, 27 Oct 2020 23:16:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYECnksvNbBS2JguWJ8FTR0IpYfEEJW6BKL/aD3SIzv33Q3VP27SaZ6jf83ajyFfHMHOqH X-Received: by 2002:a05:6402:1cbb:: with SMTP id cz27mr5845158edb.38.1603865806521; Tue, 27 Oct 2020 23:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603865806; cv=none; d=google.com; s=arc-20160816; b=ZeujkBtLGkgb0xt8gcnBbnUlihQncscg38PQq2nUfhOhVHs/60F/6l0riSRxeDTNIQ CrgNtX41+XFX6CzHJL4kn2qRtLEqu0sJf8b91XQ2de/faMjxyKwNOJUJFtYBGEguJ8li ppnw08z0lO0O9+U5p/ibgQYRCgMavvS1LToXe9GDiWKeqgtdKQjUleOWw6mCgpLVpwMT 7lACEaEd8CqEW46mkbT1LfygU9YV3AjWaLNDOU7eOcUNWrsdmucxRlSaHDnqWfGEu7QF T/GMZW3NUSJ+wzE9mdeLgNPuo1Y/UQaT35gNHQZEPN97EdRYIXNumld8ffEy+E/53zKO ZvKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=a7SYPV1dVGwcfIjgFZP0SMHB4SKNxK1Axl4OPdSZuKU=; b=mZU3dXQT16TWi5cwzpH5gXTOGW0syhqO2gaqmtPPabqqSD9i1VtOa9XIm968BYl7GZ lVWs0tT0rTPG+hEschOgFmjP7LdS0N1BmiX+Lnw0nyH1lXe8pzrlwwKpk187Bs6cEcyw daYswOW7JLsu4JjxikFyey14S2mR7BGjrwb2fm6uBWbpxWHPRjbt0uB/BIX3VGfEv+A2 I8zX9cCqg/S5GNiDj/jMY9sQbEVnjfg1R+FOHSU/QKSKi4H19gpywmLVETDV95cVkJTq 9PCSoEC4WqeSeMNyyUViAyGRUUXNRJW++PA2tjmKFCpi8FVHqHSQzSaXh1rdjssgju9Y JXTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si2610900edq.372.2020.10.27.23.16.24; Tue, 27 Oct 2020 23:16:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408838AbgJ0JdD (ORCPT + 99 others); Tue, 27 Oct 2020 05:33:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:42752 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732268AbgJ0JdD (ORCPT ); Tue, 27 Oct 2020 05:33:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F2CC5AD6B; Tue, 27 Oct 2020 09:33:01 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 6742D1E10F5; Tue, 27 Oct 2020 10:33:01 +0100 (CET) Date: Tue, 27 Oct 2020 10:33:01 +0100 From: Jan Kara To: John Hubbard Cc: Jason Gunthorpe , linux-kernel@vger.kernel.org, Andrea Arcangeli , Andrew Morton , Christoph Hellwig , Hugh Dickins , Jan Kara , Jann Horn , Kirill Shutemov , Kirill Tkhai , Linux-MM , Michal Hocko , Oleg Nesterov , Peter Xu Subject: Re: [PATCH 1/2] mm: reorganize internal_get_user_pages_fast() Message-ID: <20201027093301.GA16090@quack2.suse.cz> References: <1-v1-281e425c752f+2df-gup_fork_jgg@nvidia.com> <16c50bb0-431d-5bfb-7b80-a8af0b4da90f@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16c50bb0-431d-5bfb-7b80-a8af0b4da90f@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 23-10-20 21:44:17, John Hubbard wrote: > On 10/23/20 5:19 PM, Jason Gunthorpe wrote: > > + start += (unsigned long)nr_pinned << PAGE_SHIFT; > > + pages += nr_pinned; > > + ret = __gup_longterm_unlocked(start, nr_pages - nr_pinned, gup_flags, > > + pages); > > + if (ret < 0) { > > /* Have to be a bit careful with return values */ > > ...and can we move that comment up one level, so that it reads: > > /* Have to be a bit careful with return values */ > if (ret < 0) { > if (nr_pinned) > return nr_pinned; > return ret; > } > return ret + nr_pinned; > > Thinking about this longer term, it would be nice if the whole gup/pup API > set just stopped pretending that anyone cares about partial success, because > they *don't*. If we had return values of "0 or -ERRNO" throughout, and an > additional set of API wrappers that did some sort of limited retry just like > some of the callers do, that would be a happier story. Actually there are callers that care about partial success. See e.g. iov_iter_get_pages() usage in fs/direct_io.c:dio_refill_pages() or bio_iov_iter_get_pages(). These places handle partial success just fine and not allowing partial success from GUP could regress things... Honza -- Jan Kara SUSE Labs, CR