From patchwork Fri Jun 23 14:29:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13290738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8D8AEB64D7 for ; Fri, 23 Jun 2023 14:29:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9418C8D0009; Fri, 23 Jun 2023 10:29:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CA6D8D0001; Fri, 23 Jun 2023 10:29:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A8708D0009; Fri, 23 Jun 2023 10:29:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 458618D0001 for ; Fri, 23 Jun 2023 10:29:54 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 069AA1C9062 for ; Fri, 23 Jun 2023 14:29:54 +0000 (UTC) X-FDA: 80934246708.12.B716809 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 51D5FC0024 for ; Fri, 23 Jun 2023 14:29:50 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OaOAJHnq; spf=pass (imf28.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687530591; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=P4y7Ae1fpCTtvuEzdDqcTV3xAT7ebtLUCI261jHMfiY=; b=E9PnpcuFh8rP91LbL7xsg1m87kOn0PCNlhrqKMYkMlpPQphoCJNRy+Qzlpx2tZLkX11KNg r2MhD3Tc23V4Wfkr6bN6558zkMraF1NIAc88HRIjA0jWoJB8rjnVcmmmVf7+ajCIkTe1aX G1SX1tkJfKFeVVTqnxy1hHzWvERqfDc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687530591; a=rsa-sha256; cv=none; b=aUBsEuBinoq4VnIJclzLtXvIp9BZomezsumyrDfo66ijNRqiLfuC+ASyu/lRr0vVFJUuqo vS2GbIXt3I0lzqOjuAl3tE5lGNth8zzwJ/K6VmwNlZxBXHAB3bA0WIMyiZOY/JMt8WwmpJ j5zl5/CZKQpfGgQosG7GKbl2BZebV98= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OaOAJHnq; spf=pass (imf28.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687530590; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P4y7Ae1fpCTtvuEzdDqcTV3xAT7ebtLUCI261jHMfiY=; b=OaOAJHnqBKfmRmcmO6CDsOddqEjX6OxyfBE02vWv25MyXqK5j7lRFSirqUJ1Prrwphfygb BX9Z486xlghrROn1V3MuJdSaJuYho1pF5uPMcFkR00kLcuRTjJzNMzE0uXfxz4NDj8HqBE ED2tiEkJsJygaJgnYc+bKnOMwkZNvc8= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-nFWoN1UIN3KVXz6QNZppjw-1; Fri, 23 Jun 2023 10:29:49 -0400 X-MC-Unique: nFWoN1UIN3KVXz6QNZppjw-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-3f9e7a1caf2so2096201cf.0 for ; Fri, 23 Jun 2023 07:29:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687530588; x=1690122588; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P4y7Ae1fpCTtvuEzdDqcTV3xAT7ebtLUCI261jHMfiY=; b=TeJOANUDi8xhfrVhyOdRdEzyvsj1M+dk4hdxH/JukPxhz9JUTS1leSbhoVX6pjCDOl FRXGFdnwVcMMR4oZm0pQ0AIwjKr2eC4sMW7AOA/oOxNvOyceNEt8s86L61APbhxfW396 WLuktP++lHStsFYoL3PZoM687IOY1ZSDOMrDFtQ63uMY3iSExrkZgnnQVb4qMKYrIRVE ECoONOgt57bJerXnqI9S+1KWlPj8QrO5iCNHbLmDP2nZxRq3IZMOFjgYYYoxL7fDRFZT gzQ8wmVWedIWgoJU+7UM58k3MDIRXVY1SVZsNIY0SsSxkVBx2/f+b/lhAGJ0xrAbLB6E oz5A== X-Gm-Message-State: AC+VfDxTCZzi0GHFrcdpJlrfKrGnl2yBEWDl31fzf6TwZy/CQBM1BPiG MqTAJJi6R8bKonaPBvuuZ5gLp88gYPIwl+R0qeKkUXsxz2//MSCanCWlFfm8ES+V4jqBqA3FRec sKpsI3YAnXQthMqrFPw2xCndIDfPCK1+rC8rWNcHrGXXLGDfu0vFqGHc5F0cGunIvX7Y9 X-Received: by 2002:a05:6214:5186:b0:62d:eceb:f7ce with SMTP id kl6-20020a056214518600b0062decebf7cemr8898656qvb.1.1687530588334; Fri, 23 Jun 2023 07:29:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7xTPkKWLLEE9oaBVdmvOEL+EzktAffFIbQniQEAF//E5ihb/bIjet/WBRe0QH6WnGGRv1UOg== X-Received: by 2002:a05:6214:5186:b0:62d:eceb:f7ce with SMTP id kl6-20020a056214518600b0062decebf7cemr8898615qvb.1.1687530587775; Fri, 23 Jun 2023 07:29:47 -0700 (PDT) Received: from x1n.. (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id b9-20020a0cc989000000b0062821057ac7sm5104827qvk.39.2023.06.23.07.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 07:29:47 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Lorenzo Stoakes , John Hubbard , Andrew Morton , Mike Rapoport , David Hildenbrand , peterx@redhat.com, Yang Shi , Andrea Arcangeli , Vlastimil Babka , "Kirill A . Shutemov" , James Houghton , Matthew Wilcox , Mike Kravetz , Hugh Dickins , Jason Gunthorpe Subject: [PATCH v3 6/8] mm/gup: Retire follow_hugetlb_page() Date: Fri, 23 Jun 2023 10:29:34 -0400 Message-Id: <20230623142936.268456-7-peterx@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623142936.268456-1-peterx@redhat.com> References: <20230623142936.268456-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Stat-Signature: ififujb6dtc6xppjdk1pfnjfpyyxgeb6 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 51D5FC0024 X-Rspam-User: X-HE-Tag: 1687530590-962984 X-HE-Meta: U2FsdGVkX1+UlpMIlo0lo+CrQofQaxlOaggyRF0i+RIWxwhrOyUKtqBLnTP7oJ3zQEZn64okRJh4ebpKknHlnHFb5micni7NczCMs5wuFf3mHN8NqLZZzNbEDK9tkxKY127Kwmhf/yy4KbV97zaEjV/1naSIjzc9DBcbAkfaAzFvcFu7+nNMVZiRPy3LD7EfxKtveB90QjcIV/TyRLrrjOELbygLROT8vdAagrSmNZn6F3TA64wCfdYpQ4JDubvvWpE3ldMbkrol+SzC5pM+obl/TPpzPAMhznTyDEI9IVBoxTv2X08i7CfsA956CiVH7dhVbxH4oY/xvahdTWmYLePE3HLFBbE2N9DPaNjvR7Eg5hRZpIgkMV2tcMQJ743Nlo1w8jiR63q4dnX02JOwyXpkP7tlsZvRqz3lfc68IJBGf5qXEKr7Xrqb0AAlfWsAdeuaalgqd3qnQfU/4L8NQaanI1bAAi6D3QS8jNjQqkbgNRpx2d7h8jxIAvbbpAaJtiUsf8klpGPLmyKjDGfqixSznG0Fn3A795624i2E/M2P+233oUKUVEmTiQnCADdNbKVr2sgARQ74hBiPTytAzbHs4GPHXfMbghognFPk2Eap+iW2cRwTd4ujUjZEfhCPgk5MtAe6uqTdQA1ySgmFCGRG39LZDpSW2MZIYFHzL1GW4JxRk05KXBA9Q8fQSbPUeF4b3koBTsUqeUw8K1kA9HBwMNdLeGRT5OkDjxScCNQIVJcTmgvwiwtyvU1V/MCSspnM0H1XE7ulhKB2zVaR3k+1iOa0udyfghZR1C68x3R/nZhuuez4fVPPpDSV5H4EpPcu8hymMmFHe5m05wZ6F+KFg0PPTPFnEWx0Ln4jgQnfkToQkxTBmaf77i6Yj7FIM5czRs9snR7RXCqU+Qye0NhImIKijfLTZSkxqxeAkygDwHWJgR0mxLGs/6c+YmPK0oiaYss7VXPOZSDA15E 2Gbbc/ab 5YnrUJ8pQYEkWxqqYSK1e+tqpE/XipjaSiSS5uM/X7QNSOIm3IXo0s0tx0DwzjdiSBRPK5HhSbY/W8PGvh9T5/EuuevNoudrm9n/bQKB2T/Ph+P07hMGzlBqvbRDs+8iSlIj8Rw+kAhJzTcMZ8xrVyiDYCi1yKovkCXuHRpMFYqF46IXeJe2h1ESV9tKYA1inEPImcN16hOBK6xHtapmpQub9R2IzaBW6tmZPLJucvj9u4QVQKSAu/TA8SBOGV9REPRmYYLi8NrclxxyUkgQEPVYO9bAOxCV4M7XeBSeiw026UXH5vjQX7G2DNrR4cE2Ko99uD5pFxU192TNvMXXajLi+C9oO5VT2UfiizxiD93p0bgd3a9jqMd3MDEyYFir2lcxgzwwUqmRCVwP3DnaF5e9gEDm/vHcPWdGEUfNGMxRaAtpYYaXnsJRtnQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now __get_user_pages() should be well prepared to handle thp completely, as long as hugetlb gup requests even without the hugetlb's special path. Time to retire follow_hugetlb_page(). Tweak misc comments to reflect reality of follow_hugetlb_page()'s removal. Signed-off-by: Peter Xu Acked-by: David Hildenbrand --- fs/userfaultfd.c | 2 +- include/linux/hugetlb.h | 12 --- mm/gup.c | 19 ---- mm/hugetlb.c | 224 ---------------------------------------- 4 files changed, 1 insertion(+), 256 deletions(-) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 7cecd49e078b..ae711f1d7a83 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -427,7 +427,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) * * We also don't do userfault handling during * coredumping. hugetlbfs has the special - * follow_hugetlb_page() to skip missing pages in the + * hugetlb_follow_page_mask() to skip missing pages in the * FOLL_DUMP case, anon memory also checks for FOLL_DUMP with * the no_page_table() helper in follow_page_mask(), but the * shmem_vm_ops->fault method is invoked even during diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 2e2d89e79d6c..bb5024718fc1 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -133,9 +133,6 @@ int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, unsigned long address, unsigned int flags, unsigned int *page_mask); -long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, - struct page **, unsigned long *, unsigned long *, - long, unsigned int, int *); void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long, struct page *, zap_flags_t); @@ -305,15 +302,6 @@ static inline struct page *hugetlb_follow_page_mask( BUILD_BUG(); /* should never be compiled in if !CONFIG_HUGETLB_PAGE*/ } -static inline long follow_hugetlb_page(struct mm_struct *mm, - struct vm_area_struct *vma, struct page **pages, - unsigned long *position, unsigned long *nr_pages, - long i, unsigned int flags, int *nonblocking) -{ - BUG(); - return 0; -} - static inline int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *dst_vma, diff --git a/mm/gup.c b/mm/gup.c index 22e32cff9ac7..ac61244e6fca 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -775,9 +775,6 @@ static struct page *follow_page_mask(struct vm_area_struct *vma, * Call hugetlb_follow_page_mask for hugetlb vmas as it will use * special hugetlb page table walking code. This eliminates the * need to check for hugetlb entries in the general walking code. - * - * hugetlb_follow_page_mask is only for follow_page() handling here. - * Ordinary GUP uses follow_hugetlb_page for hugetlb processing. */ if (is_vm_hugetlb_page(vma)) return hugetlb_follow_page_mask(vma, address, flags, @@ -1138,22 +1135,6 @@ static long __get_user_pages(struct mm_struct *mm, ret = check_vma_flags(vma, gup_flags); if (ret) goto out; - - if (is_vm_hugetlb_page(vma)) { - i = follow_hugetlb_page(mm, vma, pages, - &start, &nr_pages, i, - gup_flags, locked); - if (!*locked) { - /* - * We've got a VM_FAULT_RETRY - * and we've lost mmap_lock. - * We must stop here. - */ - BUG_ON(gup_flags & FOLL_NOWAIT); - goto out; - } - continue; - } } retry: /* diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b4973edef9f2..50a3579782a5 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5721,7 +5721,6 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, /* * Return whether there is a pagecache page to back given address within VMA. - * Caller follow_hugetlb_page() holds page_table_lock so we cannot lock_page. */ static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address) @@ -6422,37 +6421,6 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte, } #endif /* CONFIG_USERFAULTFD */ -static void record_subpages(struct page *page, struct vm_area_struct *vma, - int refs, struct page **pages) -{ - int nr; - - for (nr = 0; nr < refs; nr++) { - if (likely(pages)) - pages[nr] = nth_page(page, nr); - } -} - -static inline bool __follow_hugetlb_must_fault(struct vm_area_struct *vma, - unsigned int flags, pte_t *pte, - bool *unshare) -{ - pte_t pteval = huge_ptep_get(pte); - - *unshare = false; - if (is_swap_pte(pteval)) - return true; - if (huge_pte_write(pteval)) - return false; - if (flags & FOLL_WRITE) - return true; - if (gup_must_unshare(vma, flags, pte_page(pteval))) { - *unshare = true; - return true; - } - return false; -} - struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, unsigned long address, unsigned int flags, unsigned int *page_mask) @@ -6522,198 +6490,6 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, return page; } -long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, - struct page **pages, unsigned long *position, - unsigned long *nr_pages, long i, unsigned int flags, - int *locked) -{ - unsigned long pfn_offset; - unsigned long vaddr = *position; - unsigned long remainder = *nr_pages; - struct hstate *h = hstate_vma(vma); - int err = -EFAULT, refs; - - while (vaddr < vma->vm_end && remainder) { - pte_t *pte; - spinlock_t *ptl = NULL; - bool unshare = false; - int absent; - struct page *page; - - /* - * If we have a pending SIGKILL, don't keep faulting pages and - * potentially allocating memory. - */ - if (fatal_signal_pending(current)) { - remainder = 0; - break; - } - - hugetlb_vma_lock_read(vma); - /* - * Some archs (sparc64, sh*) have multiple pte_ts to - * each hugepage. We have to make sure we get the - * first, for the page indexing below to work. - * - * Note that page table lock is not held when pte is null. - */ - pte = hugetlb_walk(vma, vaddr & huge_page_mask(h), - huge_page_size(h)); - if (pte) - ptl = huge_pte_lock(h, mm, pte); - absent = !pte || huge_pte_none(huge_ptep_get(pte)); - - /* - * When coredumping, it suits get_dump_page if we just return - * an error where there's an empty slot with no huge pagecache - * to back it. This way, we avoid allocating a hugepage, and - * the sparse dumpfile avoids allocating disk blocks, but its - * huge holes still show up with zeroes where they need to be. - */ - if (absent && (flags & FOLL_DUMP) && - !hugetlbfs_pagecache_present(h, vma, vaddr)) { - if (pte) - spin_unlock(ptl); - hugetlb_vma_unlock_read(vma); - remainder = 0; - break; - } - - /* - * We need call hugetlb_fault for both hugepages under migration - * (in which case hugetlb_fault waits for the migration,) and - * hwpoisoned hugepages (in which case we need to prevent the - * caller from accessing to them.) In order to do this, we use - * here is_swap_pte instead of is_hugetlb_entry_migration and - * is_hugetlb_entry_hwpoisoned. This is because it simply covers - * both cases, and because we can't follow correct pages - * directly from any kind of swap entries. - */ - if (absent || - __follow_hugetlb_must_fault(vma, flags, pte, &unshare)) { - vm_fault_t ret; - unsigned int fault_flags = 0; - - if (pte) - spin_unlock(ptl); - hugetlb_vma_unlock_read(vma); - - if (flags & FOLL_WRITE) - fault_flags |= FAULT_FLAG_WRITE; - else if (unshare) - fault_flags |= FAULT_FLAG_UNSHARE; - if (locked) { - fault_flags |= FAULT_FLAG_ALLOW_RETRY | - FAULT_FLAG_KILLABLE; - if (flags & FOLL_INTERRUPTIBLE) - fault_flags |= FAULT_FLAG_INTERRUPTIBLE; - } - if (flags & FOLL_NOWAIT) - fault_flags |= FAULT_FLAG_ALLOW_RETRY | - FAULT_FLAG_RETRY_NOWAIT; - if (flags & FOLL_TRIED) { - /* - * Note: FAULT_FLAG_ALLOW_RETRY and - * FAULT_FLAG_TRIED can co-exist - */ - fault_flags |= FAULT_FLAG_TRIED; - } - ret = hugetlb_fault(mm, vma, vaddr, fault_flags); - if (ret & VM_FAULT_ERROR) { - err = vm_fault_to_errno(ret, flags); - remainder = 0; - break; - } - if (ret & VM_FAULT_RETRY) { - if (locked && - !(fault_flags & FAULT_FLAG_RETRY_NOWAIT)) - *locked = 0; - *nr_pages = 0; - /* - * VM_FAULT_RETRY must not return an - * error, it will return zero - * instead. - * - * No need to update "position" as the - * caller will not check it after - * *nr_pages is set to 0. - */ - return i; - } - continue; - } - - pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT; - page = pte_page(huge_ptep_get(pte)); - - VM_BUG_ON_PAGE((flags & FOLL_PIN) && PageAnon(page) && - !PageAnonExclusive(page), page); - - /* - * If subpage information not requested, update counters - * and skip the same_page loop below. - */ - if (!pages && !pfn_offset && - (vaddr + huge_page_size(h) < vma->vm_end) && - (remainder >= pages_per_huge_page(h))) { - vaddr += huge_page_size(h); - remainder -= pages_per_huge_page(h); - i += pages_per_huge_page(h); - spin_unlock(ptl); - hugetlb_vma_unlock_read(vma); - continue; - } - - /* vaddr may not be aligned to PAGE_SIZE */ - refs = min3(pages_per_huge_page(h) - pfn_offset, remainder, - (vma->vm_end - ALIGN_DOWN(vaddr, PAGE_SIZE)) >> PAGE_SHIFT); - - if (pages) - record_subpages(nth_page(page, pfn_offset), - vma, refs, - likely(pages) ? pages + i : NULL); - - if (pages) { - /* - * try_grab_folio() should always succeed here, - * because: a) we hold the ptl lock, and b) we've just - * checked that the huge page is present in the page - * tables. If the huge page is present, then the tail - * pages must also be present. The ptl prevents the - * head page and tail pages from being rearranged in - * any way. As this is hugetlb, the pages will never - * be p2pdma or not longterm pinable. So this page - * must be available at this point, unless the page - * refcount overflowed: - */ - if (WARN_ON_ONCE(!try_grab_folio(pages[i], refs, - flags))) { - spin_unlock(ptl); - hugetlb_vma_unlock_read(vma); - remainder = 0; - err = -ENOMEM; - break; - } - } - - vaddr += (refs << PAGE_SHIFT); - remainder -= refs; - i += refs; - - spin_unlock(ptl); - hugetlb_vma_unlock_read(vma); - } - *nr_pages = remainder; - /* - * setting position is actually required only if remainder is - * not zero but it's faster not to add a "if (remainder)" - * branch. - */ - *position = vaddr; - - return i ? i : err; -} - long hugetlb_change_protection(struct vm_area_struct *vma, unsigned long address, unsigned long end, pgprot_t newprot, unsigned long cp_flags)