Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp200423imm; Fri, 21 Sep 2018 12:46:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaVNRD341l35AvHdPJEo9I3oUtWBwNDul4BBZCyoallGUgVFUhgfXo5mSacNayCz8bZxoyg X-Received: by 2002:a63:4384:: with SMTP id q126-v6mr11244343pga.142.1537559183448; Fri, 21 Sep 2018 12:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537559183; cv=none; d=google.com; s=arc-20160816; b=f5ai3gc4J2OGQIblzrd+2rMqUyBYP9EB3CD999IKYTy+4AqVbC4zjA0MMHlvz6G7fD HVjj/uL7ZEJ0Uo1zN+Ro4sqJXKSGtYgVXhWrvXWn1Qjaz3aLYE/Tr2CbQaDi1vK+d2yl YTAzBJh7KEuY2xg6tsAAAKsOB3H9QFiLs9N6lijk+v6hygh56iNmk8EAdDFFeNLm0VT3 6jjaMziWpqv3Flw+vyWmF1d0TMJXIJTckMWJOGE9PozFQD+3vzrFWbFkFx5CgNwxgFLh BnyLegL7s0diLaFqZ9K9sezEfgkzMiYeo1+e3OnMyQmuXh0ASAULrGPYR84Ie7GNYuM/ pkUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=L/8YhKWCfEG0Imi4gGYHLHbRKNj4VkcPJBdZJGV9Tzw=; b=UrAHvEL5YNTuUsZAAFvJbefxFaLuVOuJzKvYWvIj3wD+lxl3e/AhWu+COqeMb35RnC JLBqAbbW2gQ/StPN8KndRwV4LCWodKOsoJ027oLv9MMoVaoI9w2kFCTx04i2MhCMp6I2 5h/cC3WgZXvxV30fLSPtD8ueS4iZcpEpRl8cifxnYPFs9x85t+zucckD9fbO6afDzHpG VVt5Nm7UDIqqO85/GekR8e42fMspq1pFQ5Bastm0TPQFmyumwd7WHFVuu3uvHJKvNwmV niCsTiM2qVPg0azyzb3mpGT7g8A4VWVth2aVP1Xdn+DsTrNENuef8yQsY+EbdgvPsE6c HE1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Aq+gRgBM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q132-v6si31265285pfc.159.2018.09.21.12.46.07; Fri, 21 Sep 2018 12:46:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Aq+gRgBM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391371AbeIVBf5 (ORCPT + 99 others); Fri, 21 Sep 2018 21:35:57 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:42739 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391160AbeIVBf4 (ORCPT ); Fri, 21 Sep 2018 21:35:56 -0400 Received: by mail-oi0-f68.google.com with SMTP id v198-v6so12367436oif.9 for ; Fri, 21 Sep 2018 12:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L/8YhKWCfEG0Imi4gGYHLHbRKNj4VkcPJBdZJGV9Tzw=; b=Aq+gRgBMxK5tVyVaOMp+pPJuly0tu7HGa0lTKNLY6bosTCegmHYzM9e67MMA12sBAf X2vvOUn2LB4lAflMJvhLW0nk/RkU8QdttEjXkAC1ZsZDmfpALOH7veMbkbCbUqUb1XMb m/o5D3ZChylulNtktahNMQMYuk2fXzsO6HSn7HIcODYuhAH0rqpAoJM8tQDSIwcYL9ZR 9Y461HrUorIZsPVDSPN+iajxBpSCku0e1gEMyqtRgm/rtYgSIHzLGnr3pV7OrRA11gXx 5+JwTEbVrP9tk4PcUEyxvqPyXA7x5XOGgQ6tzbLjM3cJVv7KKJpNAOGpkNf2k5OguM+8 eeig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L/8YhKWCfEG0Imi4gGYHLHbRKNj4VkcPJBdZJGV9Tzw=; b=i/1YJFuE4PeEeu3nCYGdL0Sy/YjVzzpEJVbKwmVbXiOSKIpfeUsHSCqw2WGBs+hF4M OXJ1OhKuav0GAWdjoWeex0dbL6pYRmXl33rBz/mY2+XPIdBdjoziBfpGT3EW8t9BWlgj JfHt/YH9eAw+M5tm07gE4AuVm3A5ntEPzh6S8N7IRToIXVGB/+q0MCaCHUy2iOqH6Go9 N/ouR4+50UVsGfe0LVMY9zotCGTG6LdZJAB9XQ/XjUFgrMHj2XzWwVYmYhxbL/PD62QI 0HhceilDizVGr2i2xio8+dy0vxGaReStA7wv/68pOSxg3Z1Q2N4RMyG6HHv8AZ+Vrnbs lkMg== X-Gm-Message-State: APzg51B5RxvkxF5ZfjbDkodAk4sdZd5FoqafbWDJgcQtXBAQxcgHS7+Q RIxEgqns72qvrkqt1dwlsum2+q49NdfWnkbvgXQzQg== X-Received: by 2002:aca:a8c1:: with SMTP id r184-v6mr43933oie.215.1537559135145; Fri, 21 Sep 2018 12:45:35 -0700 (PDT) MIME-Version: 1.0 References: <20180920200358.31680-1-keith.busch@intel.com> <20180920200358.31680-7-keith.busch@intel.com> In-Reply-To: <20180920200358.31680-7-keith.busch@intel.com> From: Dan Williams Date: Fri, 21 Sep 2018 12:45:23 -0700 Message-ID: Subject: Re: [PATCHv2 6/7] mm/gup: Combine parameters into struct To: Keith Busch Cc: Linux Kernel Mailing List , "Kirill A. Shutemov" , Dave Hansen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 20, 2018 at 1:03 PM Keith Busch wrote: > > This will make it easier to add new parameters that we may wish to > thread through these function calls. > > Cc: Kirill Shutemov > Cc: Dave Hansen > Cc: Dan Williams > Signed-off-by: Keith Busch > --- > include/linux/huge_mm.h | 12 +-- > include/linux/hugetlb.h | 2 +- > include/linux/mm.h | 21 ++++- > mm/gup.c | 238 +++++++++++++++++++++++------------------------- > mm/huge_memory.c | 32 +++---- > mm/nommu.c | 6 +- > 6 files changed, 151 insertions(+), 160 deletions(-) > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > index 99c19b06d9a4..7d22e2c7f154 100644 > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -212,10 +212,8 @@ static inline int hpage_nr_pages(struct page *page) > return 1; > } > > -struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr, > - pmd_t *pmd, int flags); > -struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr, > - pud_t *pud, int flags); > +struct page *follow_devmap_pmd(struct follow_page_context *ctx, pmd_t *pmd); > +struct page *follow_devmap_pud(struct follow_page_context *ctx, pud_t *pud); > > extern vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd); > > @@ -343,14 +341,12 @@ static inline void mm_put_huge_zero_page(struct mm_struct *mm) > return; > } > > -static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma, > - unsigned long addr, pmd_t *pmd, int flags) > +static inline struct page *follow_devmap_pmd(struct gup_context *ctx, pmd_t *pmd) > { > return NULL; > } > > -static inline struct page *follow_devmap_pud(struct vm_area_struct *vma, > - unsigned long addr, pud_t *pud, int flags) > +static inline struct page *follow_devmap_pud(struct gup_context *ctx, pud_t *pud) > { > return NULL; > } > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 6b68e345f0ca..64b675863793 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -180,7 +180,7 @@ static inline void hugetlb_report_meminfo(struct seq_file *m) > static inline void hugetlb_show_meminfo(void) > { > } > -#define follow_huge_pd(vma, addr, hpd, flags, pdshift) NULL > +#define follow_huge_pd(ctx, hpd, pdshift) NULL > #define follow_huge_pmd(mm, addr, pmd, flags) NULL > #define follow_huge_pud(mm, addr, pud, flags) NULL > #define follow_huge_pgd(mm, addr, pgd, flags) NULL > diff --git a/include/linux/mm.h b/include/linux/mm.h > index a61ebe8ad4ca..f1fd241c9071 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -378,6 +378,13 @@ struct vm_fault { > */ > }; > > +struct follow_page_context { > + struct vm_area_struct *vma; > + unsigned long address; > + unsigned int page_mask; > + unsigned int flags; > +}; I was thinking that the context would only contain the in/out parameters of page_mask and pgmap. I don't think we plan to have more parameters beyond this one addition and from a code readability standpoint the less "ctx->" the better.