From patchwork Thu Jul 27 21:28:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13330777 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB0BBEB64DD for ; Thu, 27 Jul 2023 21:30:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbjG0Vaf (ORCPT ); Thu, 27 Jul 2023 17:30:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232230AbjG0VaY (ORCPT ); Thu, 27 Jul 2023 17:30:24 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B44B81984 for ; Thu, 27 Jul 2023 14:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690493338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3V6q8K76IOW6dvze9Iao5sragyvrE9hiergd1FJ9CnQ=; b=QfVpS+sZ0KzzSBMiSLaHnlmxftylQ5WGVGfCFcnoYLOi9rAijbCYFS0DbuS2l44Ui9IQug kdPZdDclchrqcwYJ0KAqweF2ke16ByReBJMIRBdWKsdVJezluBECLGnlgXkut0kMtWWOI1 Lz9OMOrgMVBd4gO1FgP/YJs40HarXSg= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-16-1ckDkazHPumtGeeYi-ezOg-1; Thu, 27 Jul 2023 17:28:53 -0400 X-MC-Unique: 1ckDkazHPumtGeeYi-ezOg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E0FA3810D42; Thu, 27 Jul 2023 21:28:53 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41E6C40C2063; Thu, 27 Jul 2023 21:28:50 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Linus Torvalds , liubo , Peter Xu , Matthew Wilcox , Hugh Dickins , Jason Gunthorpe , John Hubbard , stable@vger.kernel.org Subject: [PATCH v1 1/4] smaps: Fix the abnormal memory statistics obtained through /proc/pid/smaps Date: Thu, 27 Jul 2023 23:28:42 +0200 Message-ID: <20230727212845.135673-2-david@redhat.com> In-Reply-To: <20230727212845.135673-1-david@redhat.com> References: <20230727212845.135673-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: liubo In commit 474098edac26 ("mm/gup: replace FOLL_NUMA by gup_can_follow_protnone()"), FOLL_NUMA was removed and replaced by the gup_can_follow_protnone interface. However, for the case where the user-mode process uses transparent huge pages, when analyzing the memory usage through /proc/pid/smaps_rollup, the obtained memory usage is not consistent with the RSS in /proc/pid/status. Related examples are as follows: cat /proc/15427/status VmRSS: 20973024 kB RssAnon: 20971616 kB RssFile: 1408 kB RssShmem: 0 kB cat /proc/15427/smaps_rollup 00400000-7ffcc372d000 ---p 00000000 00:00 0 [rollup] Rss: 14419432 kB Pss: 14418079 kB Pss_Dirty: 14418016 kB Pss_Anon: 14418016 kB Pss_File: 63 kB Pss_Shmem: 0 kB Anonymous: 14418016 kB LazyFree: 0 kB AnonHugePages: 14417920 kB The root cause is that the traversal In the page table, the number of pages obtained by smaps_pmd_entry does not include the pages corresponding to PROTNONE,resulting in a different situation. Therefore, when obtaining pages through the follow_trans_huge_pmd interface, add the FOLL_FORCE flag to count the pages corresponding to PROTNONE to solve the above problem. Signed-off-by: liubo Cc: stable@vger.kernel.org Fixes: 474098edac26 ("mm/gup: replace FOLL_NUMA by gup_can_follow_protnone()") Signed-off-by: David Hildenbrand # AKPM fixups, cc stable Signed-off-by: David Hildenbrand --- fs/proc/task_mmu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index c1e6531cb02a..7075ce11dc7d 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -571,8 +571,12 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, bool migration = false; if (pmd_present(*pmd)) { - /* FOLL_DUMP will return -EFAULT on huge zero page */ - page = follow_trans_huge_pmd(vma, addr, pmd, FOLL_DUMP); + /* + * FOLL_DUMP will return -EFAULT on huge zero page + * FOLL_FORCE follow a PROT_NONE mapped page + */ + page = follow_trans_huge_pmd(vma, addr, pmd, + FOLL_DUMP | FOLL_FORCE); } else if (unlikely(thp_migration_supported() && is_swap_pmd(*pmd))) { swp_entry_t entry = pmd_to_swp_entry(*pmd); From patchwork Thu Jul 27 21:28:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13330776 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8806C00528 for ; Thu, 27 Jul 2023 21:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232087AbjG0V3s (ORCPT ); Thu, 27 Jul 2023 17:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbjG0V3p (ORCPT ); Thu, 27 Jul 2023 17:29:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 421A710CB for ; Thu, 27 Jul 2023 14:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690493337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NHdYsiNqqxFFYOyFZT8N/uUoLYdRyRl4LhGdK5bhGpM=; b=NPC43X2+TbQc6Hc2VTXizEy/a7NdbgIM5vol+c2iOZ+2hggR6tRvaRwUMQLDB5CAhmPGOe s1YHc15Xn3yQchCXYtwR3OVTEvGgjty+vWkNuiJGFWfvpkyuu/C3tSz3NnIf01pWMnKZdq DBTO7AdYuFkoPQyArBAl+meGyrxRa1Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-F0H8AQw3M0yhKgh2HgjDcA-1; Thu, 27 Jul 2023 17:28:56 -0400 X-MC-Unique: F0H8AQw3M0yhKgh2HgjDcA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 50B76104458B; Thu, 27 Jul 2023 21:28:55 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67C2B40C2063; Thu, 27 Jul 2023 21:28:53 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Linus Torvalds , liubo , Peter Xu , Matthew Wilcox , Hugh Dickins , Jason Gunthorpe , John Hubbard , stable@vger.kernel.org Subject: [PATCH v1 2/4] mm/gup: Make follow_page() succeed again on PROT_NONE PTEs/PMDs Date: Thu, 27 Jul 2023 23:28:43 +0200 Message-ID: <20230727212845.135673-3-david@redhat.com> In-Reply-To: <20230727212845.135673-1-david@redhat.com> References: <20230727212845.135673-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org We accidentally enforced PROT_NONE PTE/PMD permission checks for follow_page() like we do for get_user_pages() and friends. That was undesired, because follow_page() is usually only used to lookup a currently mapped page, not to actually access it. Further, follow_page() does not actually trigger fault handling, but instead simply fails. Let's restore that behavior by conditionally setting FOLL_FORCE if FOLL_WRITE is not set. This way, for example KSM and migration code will no longer fail on PROT_NONE mapped PTEs/PMDS. Handling this internally doesn't require us to add any new FOLL_FORCE usage outside of GUP code. While at it, refuse to accept FOLL_FORCE: we don't even perform VMA permission checks like in check_vma_flags(), so especially FOLL_FORCE|FOLL_WRITE would be dodgy. This issue was identified by code inspection. We'll add some documentation regarding FOLL_FORCE next. Reported-by: Peter Xu Fixes: 474098edac26 ("mm/gup: replace FOLL_NUMA by gup_can_follow_protnone()") Cc: Signed-off-by: David Hildenbrand --- mm/gup.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 2493ffa10f4b..da9a5cc096ac 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -841,9 +841,17 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, if (vma_is_secretmem(vma)) return NULL; - if (WARN_ON_ONCE(foll_flags & FOLL_PIN)) + if (WARN_ON_ONCE(foll_flags & (FOLL_PIN | FOLL_FORCE))) return NULL; + /* + * Traditionally, follow_page() succeeded on PROT_NONE-mapped pages + * but failed follow_page(FOLL_WRITE) on R/O-mapped pages. Let's + * keep these semantics by setting FOLL_FORCE if FOLL_WRITE is not set. + */ + if (!(foll_flags & FOLL_WRITE)) + foll_flags |= FOLL_FORCE; + page = follow_page_mask(vma, address, foll_flags, &ctx); if (ctx.pgmap) put_dev_pagemap(ctx.pgmap); From patchwork Thu Jul 27 21:28:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13330779 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28A9FC04A94 for ; Thu, 27 Jul 2023 21:30:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232132AbjG0Vaj (ORCPT ); Thu, 27 Jul 2023 17:30:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231675AbjG0Vac (ORCPT ); Thu, 27 Jul 2023 17:30:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 938B91BC3 for ; Thu, 27 Jul 2023 14:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690493343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gg+vYFf2MUM715aNnpsI37yVDyYtQwBsTVNC7NmhATc=; b=e3VCchc75lZUUCtzE/TjD1I5f3oVWv8LqGr7uoUV3TZGqNRWjHEyEjJtLutoDP17IE/e75 uQcGOTqm2yxEjuN1sc1T8trOlj9VtIyXcD23oM8mcB6bnWniU1OoCog6fwXNyPPHyzc5MS omPnY1zl2TMwU+vRcuuQSUacqyMWhwg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-359-RlyUAFoMPPO8N1iA8aE7qw-1; Thu, 27 Jul 2023 17:28:58 -0400 X-MC-Unique: RlyUAFoMPPO8N1iA8aE7qw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 924CC805951; Thu, 27 Jul 2023 21:28:57 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91ABF40C2063; Thu, 27 Jul 2023 21:28:55 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Linus Torvalds , liubo , Peter Xu , Matthew Wilcox , Hugh Dickins , Jason Gunthorpe , John Hubbard Subject: [PATCH v1 3/4] smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd() Date: Thu, 27 Jul 2023 23:28:44 +0200 Message-ID: <20230727212845.135673-4-david@redhat.com> In-Reply-To: <20230727212845.135673-1-david@redhat.com> References: <20230727212845.135673-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org We really shouldn't be using a GUP-internal helper if it can be avoided, and avoiding the FOLL_FORCE here is certainly desirable. Similar to smaps_pte_entry() that uses vm_normal_page(), let's use vm_normal_page_pmd() -- that didn't exist back when we introduced that code -- that similarly refuses to return the huge zeropage. Signed-off-by: David Hildenbrand --- fs/proc/task_mmu.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 7075ce11dc7d..b8ea270bf68b 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -571,12 +571,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, bool migration = false; if (pmd_present(*pmd)) { - /* - * FOLL_DUMP will return -EFAULT on huge zero page - * FOLL_FORCE follow a PROT_NONE mapped page - */ - page = follow_trans_huge_pmd(vma, addr, pmd, - FOLL_DUMP | FOLL_FORCE); + page = vm_normal_page_pmd(vma, addr, *pmd); } else if (unlikely(thp_migration_supported() && is_swap_pmd(*pmd))) { swp_entry_t entry = pmd_to_swp_entry(*pmd); From patchwork Thu Jul 27 21:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13330778 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0FE0EB64DD for ; Thu, 27 Jul 2023 21:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbjG0Vai (ORCPT ); Thu, 27 Jul 2023 17:30:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbjG0Vac (ORCPT ); Thu, 27 Jul 2023 17:30:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 875CF1BF4 for ; Thu, 27 Jul 2023 14:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690493346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jGnguQzUAnXSgoEJGq4aUCEYI9GBqFjghH3nhnid2s4=; b=LIC7PjXhU9JMtnKM9nSmeuF1a9xgG9GFaBlxxlaWTzxGhlur1/EHHl6cMA/PB6irJFFvHR w6rgIbpOiD1oZRcHhps7I4vwqJA9ir3HGxekS1nQtxLRIg9yT4psGr+6Grs4AE/ogvHQo8 TC7uDaptFi8DjjSsuC+OMyKw10nneEw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-49-u7XBChHRONmnMfoWeq8OoQ-1; Thu, 27 Jul 2023 17:29:00 -0400 X-MC-Unique: u7XBChHRONmnMfoWeq8OoQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C80A3856F66; Thu, 27 Jul 2023 21:28:59 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDA6240C2063; Thu, 27 Jul 2023 21:28:57 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Linus Torvalds , liubo , Peter Xu , Matthew Wilcox , Hugh Dickins , Jason Gunthorpe , John Hubbard Subject: [PATCH v1 4/4] mm/gup: document FOLL_FORCE behavior Date: Thu, 27 Jul 2023 23:28:45 +0200 Message-ID: <20230727212845.135673-5-david@redhat.com> In-Reply-To: <20230727212845.135673-1-david@redhat.com> References: <20230727212845.135673-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org As suggested by Peter, let's document FOLL_FORCE handling and make it clear that without FOLL_FORCE, we will always trigger NUMA-hinting faults when stumbling over a PROT_NONE-mapped PTE. Also add a comment regarding follow_page() and its interaction with FOLL_FORCE. Let's place the doc next to the definition, where it certainly can't be missed. Signed-off-by: David Hildenbrand --- include/linux/mm_types.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 2fa6fcc740a1..96cf78686c29 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -1243,7 +1243,30 @@ enum { FOLL_GET = 1 << 1, /* give error on hole if it would be zero */ FOLL_DUMP = 1 << 2, - /* get_user_pages read/write w/o permission */ + /* + * Make get_user_pages() and friends ignore some VMA+PTE permissions. + * + * This flag should primarily only be used by ptrace and some + * GUP-internal functionality, such as for mlock handling. + * + * Without this flag, these functions always trigger page faults + * (such as NUMA hinting faults) when stumbling over a + * PROT_NONE-mapped PTE. + * + * !FOLL_WRITE: succeed even if the PTE is PROT_NONE + * * Rejected if the VMA is currently not readable and it cannot + * become readable + * + * FOLL_WRITE: succeed even if the PTE is not writable. + * * Rejected if the VMA is currently not writable and + * * it is a hugetlb mapping + * * it is not a COW mapping that could become writable + * + * Note: follow_page() does not accept FOLL_FORCE. Historically, + * follow_page() behaved similar to FOLL_FORCE without FOLL_WRITE: + * succeed even if the PTE is PROT_NONE and FOLL_WRITE is not set. + * However, VMA permissions are not checked. + */ FOLL_FORCE = 1 << 3, /* * if a disk transfer is needed, start the IO and return without waiting