Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3261928yba; Sun, 28 Apr 2019 21:57:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpxOUiM88x61cqtJLyEjIPpLvbnbBXW/wJxCvSuFHEyKAC5mwGFCzEs/RL5ikkmBwvpbI8 X-Received: by 2002:a17:902:7c01:: with SMTP id x1mr25158349pll.299.1556513825733; Sun, 28 Apr 2019 21:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556513825; cv=none; d=google.com; s=arc-20160816; b=IRs+b3OKqzh3gC0HhBzCJcUnDSHb7uP41RDPor642/Qsi4W5sOpYlRD3I2xYfc+gZi dEN8jknt+0B3L+MfGzk5uRc27aXuLcvAjH2aNCrECwMAktCFDlrmglMuPrRS58CS2zHh GjNh0nLxMCjj5fDt38K2BtNLWJApDxFvg657ckHUxpSxvZfcjoiTNoAUGBQYrVElM0F8 X1hoxRDl67nrt2cQw0ssTAFZz+xOfixKVfuXfjt6FXVe5MlW8pGEfBOujdeusrEYA8IZ s8ppPqnQkM84Eri3JTr++5MxfheyKYTYMAWLbJwO9/15h21o1xJJ1f6Z6lRTNIXJw/o9 S2bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DUvFDn7C5Eh34MdB6r7GUuxOF+hBXuSzGP9HXtCcuKI=; b=V0gDo3Etm2KW3KOOdijwjA8vFr+MoJ08g2fyVkflr7q/P35hoUyeh0a8o9COwpNHVY 90JtzWvviy9KYc5QEZK0o1OUak6GD0r5OuioMamR2jN8RIpaRAK5JLtjzBrz5AB/hpPP eilz5vWi9qSOgJpTbCfPiA+MFFAKDOdFPoll1HbP96S4Pjuxo8HutRUnbssxsjeY0vV/ Y2VEdjXtDtuEELIJA2vubcFnv5kBPDUX30rGfSGhcCWTXCq9OiBJbFokJwGfYRJNu6pv 6MtDwVRDGlIBkUs4HrjMP1SMdRzIFjiRCIyFizH2XYdF50lzi5stNf1yqH7U9IwrCJRF J9CA== ARC-Authentication-Results: i=1; mx.google.com; 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 41si33609048plb.164.2019.04.28.21.56.51; Sun, 28 Apr 2019 21:57:05 -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; 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 S1727368AbfD2Ey3 (ORCPT + 99 others); Mon, 29 Apr 2019 00:54:29 -0400 Received: from mga03.intel.com ([134.134.136.65]:28447 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727261AbfD2EyL (ORCPT ); Mon, 29 Apr 2019 00:54:11 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2019 21:54:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,408,1549958400"; d="scan'208";a="146566319" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga003.jf.intel.com with ESMTP; 28 Apr 2019 21:54:10 -0700 From: ira.weiny@intel.com To: lsf-pc@lists.linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dan Williams , Jan Kara , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , John Hubbard , Michal Hocko , Ira Weiny Subject: [RFC PATCH 10/10] mm/gup: Remove FOLL_LONGTERM DAX exclusion Date: Sun, 28 Apr 2019 21:53:59 -0700 Message-Id: <20190429045359.8923-11-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190429045359.8923-1-ira.weiny@intel.com> References: <20190429045359.8923-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ira Weiny Now that there is a mechanism for users to safely take LONGTERM pins on FS DAX pages. Remove the FS DAX exclusion from GUP with FOLL_LONGTERM. Special processing remains in effect for CONFIG_CMA --- mm/gup.c | 65 ++++++-------------------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 1ee17f2339f7..cf6863422cb9 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1324,26 +1324,6 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, } EXPORT_SYMBOL(get_user_pages_remote); -#if defined(CONFIG_FS_DAX) || defined (CONFIG_CMA) -static bool check_dax_vmas(struct vm_area_struct **vmas, long nr_pages) -{ - long i; - struct vm_area_struct *vma_prev = NULL; - - for (i = 0; i < nr_pages; i++) { - struct vm_area_struct *vma = vmas[i]; - - if (vma == vma_prev) - continue; - - vma_prev = vma; - - if (vma_is_fsdax(vma)) - return true; - } - return false; -} - #ifdef CONFIG_CMA static struct page *new_non_cma_page(struct page *page, unsigned long private) { @@ -1474,18 +1454,6 @@ static long check_and_migrate_cma_pages(struct task_struct *tsk, return nr_pages; } -#else -static long check_and_migrate_cma_pages(struct task_struct *tsk, - struct mm_struct *mm, - unsigned long start, - unsigned long nr_pages, - struct page **pages, - struct vm_area_struct **vmas, - unsigned int gup_flags) -{ - return nr_pages; -} -#endif /* * __gup_longterm_locked() is a wrapper for __get_user_pages_locked which @@ -1499,49 +1467,28 @@ static long __gup_longterm_locked(struct task_struct *tsk, struct vm_area_struct **vmas, unsigned int gup_flags) { - struct vm_area_struct **vmas_tmp = vmas; unsigned long flags = 0; - long rc, i; + long rc; - if (gup_flags & FOLL_LONGTERM) { - if (!pages) - return -EINVAL; - - if (!vmas_tmp) { - vmas_tmp = kcalloc(nr_pages, - sizeof(struct vm_area_struct *), - GFP_KERNEL); - if (!vmas_tmp) - return -ENOMEM; - } + if (flags & FOLL_LONGTERM) flags = memalloc_nocma_save(); - } rc = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, - vmas_tmp, NULL, gup_flags); + vmas, NULL, gup_flags); if (gup_flags & FOLL_LONGTERM) { memalloc_nocma_restore(flags); if (rc < 0) goto out; - if (check_dax_vmas(vmas_tmp, rc)) { - for (i = 0; i < rc; i++) - put_page(pages[i]); - rc = -EOPNOTSUPP; - goto out; - } - rc = check_and_migrate_cma_pages(tsk, mm, start, rc, pages, - vmas_tmp, gup_flags); + vmas, gup_flags); } out: - if (vmas_tmp != vmas) - kfree(vmas_tmp); return rc; } -#else /* !CONFIG_FS_DAX && !CONFIG_CMA */ +#else /* !CONFIG_CMA */ static __always_inline long __gup_longterm_locked(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, @@ -1553,7 +1500,7 @@ static __always_inline long __gup_longterm_locked(struct task_struct *tsk, return __get_user_pages_locked(tsk, mm, start, nr_pages, pages, vmas, NULL, flags); } -#endif /* CONFIG_FS_DAX || CONFIG_CMA */ +#endif /* CONFIG_CMA */ /* * This is the same as get_user_pages_remote(), just with a -- 2.20.1