Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp96170pxu; Wed, 2 Dec 2020 16:09:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzx/qvsD2oPtTfPuvw3/K02UguwD2O+ICA7V1Ij1v1bluXHQuF/mtXNniJwUpyfuJkS7jju X-Received: by 2002:a50:fd18:: with SMTP id i24mr532440eds.146.1606954179154; Wed, 02 Dec 2020 16:09:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606954179; cv=none; d=google.com; s=arc-20160816; b=T306Ki8l58u1xcg03VwrH1SdwNIggiMIVYdbjVLfREcbYFciGtZUsS1j8TY8ltkraR 80KIhj0ALQHHbY3yFyOVE/XnBfwtRK6jwxugfxuwWW2PoCk1Tl9DQKJZ5rsC6JcM8x4S zxodgayVljLVCyMOMuYgsRKiDvLorBHMMj3a5op/xu/puPxGWiiiz9b1V501sgGFhCCa Yx/HkvjwYveXC2MVeaOVwGM3HhVyoa1Zs5IuyuC3z21tGx3LW+d2Ym1jIZrzYV01VZZV Gbq9EoDlcIxU+e6FDwqEZClKZZZ4cNEPP2B8a5TJZIv2Znl68+fgbW0NbkaBe7C1m1NJ oFCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HL4ZccAHg5V6Bd07F/4aifaU3FUPzQVBX0asc7HSKow=; b=RLX5bpstI3wfGc9xev7O6JBQ7+KiyBrTEE6j9qGgEHzFiy20e1cTtp/G/vumU/RIUE xJ1HcOIMjqU73jZ9V9CMkykmF87eIfu2l4szlm/3WeJU6nJMyM9z7dBQssCAnLQKdHlR ry43wZzMmbkFz80b/MSZaCClc0NTM30rDdEX08iEhlvQoBczo+a1CuB4g7vBVIw/vY2c rhd+e45VDGU4ZnsuuFMRUd6KYJ9hFuoCO93UmhQ6B6pSPKjFh3ReBgcuC5gGuCgU3xPs J/MYGlG6h1qegbLzKupSqKX+v156j1C7uOr8EzeIWGCu0sBBZbya6mE4Iwz4TtBwOOuu vIvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b="klh/Kg3B"; 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 c26si201000edv.182.2020.12.02.16.09.15; Wed, 02 Dec 2020 16:09:39 -0800 (PST) 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; dkim=pass header.i=@soleen.com header.s=google header.b="klh/Kg3B"; 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 S1729226AbgLCAEW (ORCPT + 99 others); Wed, 2 Dec 2020 19:04:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729200AbgLCAEV (ORCPT ); Wed, 2 Dec 2020 19:04:21 -0500 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D3DC0613D6 for ; Wed, 2 Dec 2020 16:03:41 -0800 (PST) Received: by mail-ed1-x541.google.com with SMTP id cm17so128964edb.4 for ; Wed, 02 Dec 2020 16:03:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HL4ZccAHg5V6Bd07F/4aifaU3FUPzQVBX0asc7HSKow=; b=klh/Kg3BizeiBqwvr7+X9DewlNQbIet2xxxofeWSvOolzkU9vrhZeGs19vQNq8tO4w SPMgZ8AibuFQ5sfLT1meSGaaOo3jfDzMYoYJU86tumYCS9bJH23Fhu2Mjw8cuqeMq4p/ D0fR290cz4g2oCt+D+TAFu59j+h6ipOxhWako8EKL5xrcNZqcfevPtFoYRWZPuKTwxf8 +B2EJKO59foyBuQ98EPeK3kpJY5KEXe40Ty3H6T9l/eR0Du2Nf83UcvRFBtkMeRNPMSr Tk0odFOyAi18mvyoixC1dCdJzVYHVnWAmlbFPNvgzrpC90i6AjPAc8HuAbWQz2uXn28B Af6A== 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=HL4ZccAHg5V6Bd07F/4aifaU3FUPzQVBX0asc7HSKow=; b=hWO0BZ3hRHfDNCcaVR4zqyGxYLQRfdvWiav9rAf+/q9uqwfCaC18enYcEnOILwBPmp 79jUkKSIgpQ7wLp1XF2K6BUDnWBjKkMdkh/MFK+5Y29OawFA48DwAGtQSfdxWEx60h9s LVrB5sq5nSbnJpnLE5Y86+xm0PDH4gpCCSRUxEB4P8BLGSvQAmxOPdQtn3O3xtezd+HZ +1SzfEpUdrKoE7egYEqTtJiZbVvFr3uMyfUDzDHfoO2Lq+5fDx/TZGWAaExMfYnxCWwH hurBmRlN2LQ/qCHf37Jb0Gb7H7QN6i2sa/Npiwf6PhrLcL7xkTJmwWbLYM8VlOIBxj2K z7wQ== X-Gm-Message-State: AOAM531j80yGTo4YIqQ+61VKMIBBK07JJl3igBHLoyAdK0qX2QiOW2v8 Trw/mWtFGa59oEZmjYBV70o02ZZ7UVX4f7bmKjYG3w== X-Received: by 2002:aa7:c652:: with SMTP id z18mr490202edr.60.1606953819960; Wed, 02 Dec 2020 16:03:39 -0800 (PST) MIME-Version: 1.0 References: <20201202052330.474592-1-pasha.tatashin@soleen.com> <20201202052330.474592-4-pasha.tatashin@soleen.com> <20201202163145.GT1161629@iweiny-DESK2.sc.intel.com> <20201202163312.GU1161629@iweiny-DESK2.sc.intel.com> In-Reply-To: From: Pavel Tatashin Date: Wed, 2 Dec 2020 19:03:04 -0500 Message-ID: Subject: Re: [PATCH 3/6] mm/gup: make __gup_longterm_locked common To: Ira Weiny Cc: LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Jason Gunthorpe , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes , John Hubbard Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 2, 2020 at 1:19 PM Pavel Tatashin wrote: > > On Wed, Dec 2, 2020 at 11:33 AM Ira Weiny wrote: > > > > On Wed, Dec 02, 2020 at 08:31:45AM -0800, 'Ira Weiny' wrote: > > > On Wed, Dec 02, 2020 at 12:23:27AM -0500, Pavel Tatashin wrote: > > > > __gup_longterm_locked() has CMA || FS_DAX version and a common stub > > > > version. In the preparation of prohibiting longterm pinning of pages from > > > > movable zone make the CMA || FS_DAX version common, and delete the stub > > > > version. > > > > > > > > Signed-off-by: Pavel Tatashin > > > > --- > > > > mm/gup.c | 13 ------------- > > > > 1 file changed, 13 deletions(-) > > > > > > > > diff --git a/mm/gup.c b/mm/gup.c > > > > index 3a76c005a3e2..0e2de888a8b0 100644 > > > > --- a/mm/gup.c > > > > +++ b/mm/gup.c > > > > @@ -1567,7 +1567,6 @@ struct page *get_dump_page(unsigned long addr) > > > > } > > > > #endif /* CONFIG_ELF_CORE */ > > > > > > > > -#if defined(CONFIG_FS_DAX) || defined (CONFIG_CMA) > > > > #ifdef CONFIG_FS_DAX > > > > static bool check_dax_vmas(struct vm_area_struct **vmas, long nr_pages) > > > > { > > > > @@ -1757,18 +1756,6 @@ static long __gup_longterm_locked(struct mm_struct *mm, > > > > kfree(vmas_tmp); > > > > return rc; > > > > } > > > > > > Isn't this going to potentially allocate vmas_tmp only to not need it when > > > !FS_DAX and !CMA? > > > > To clarify, when FOLL_LONGTERM is set... > > Yes, this is the case. We need that because once migration is checked > for all allocations, not only CMA, we need vmas_tmp for all cases. A slight correction, we only need vmas_tmp for check_dax_vmas(). Potentially, we could wrap vmas_tmp allocation in a #ifdef for FS_DAX, but I do not think this is really needed. Pasha > > Pasha > > > > > IRa > > > > > > > > Ira > > > > > > > -#else /* !CONFIG_FS_DAX && !CONFIG_CMA */ > > > > -static __always_inline long __gup_longterm_locked(struct mm_struct *mm, > > > > - unsigned long start, > > > > - unsigned long nr_pages, > > > > - struct page **pages, > > > > - struct vm_area_struct **vmas, > > > > - unsigned int flags) > > > > -{ > > > > - return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, > > > > - NULL, flags); > > > > -} > > > > -#endif /* CONFIG_FS_DAX || CONFIG_CMA */ > > > > > > > > static bool is_valid_gup_flags(unsigned int gup_flags) > > > > { > > > > -- > > > > 2.25.1 > > > > > > > > > > >