Message ID | 20211115080323.75209-1-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=Pe7y=QC=kvack.org=owner-linux-mm@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FF75C433FE for <linux-mm@archiver.kernel.org>; Mon, 15 Nov 2021 08:03:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0F14561B97 for <linux-mm@archiver.kernel.org>; Mon, 15 Nov 2021 08:03:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0F14561B97 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id ACAC96B007E; Mon, 15 Nov 2021 03:03:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A7AF86B0080; Mon, 15 Nov 2021 03:03:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9436D6B009A; Mon, 15 Nov 2021 03:03:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 863AB6B007E for <linux-mm@kvack.org>; Mon, 15 Nov 2021 03:03:41 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 51C7082FEC for <linux-mm@kvack.org>; Mon, 15 Nov 2021 08:03:41 +0000 (UTC) X-FDA: 78810425442.08.9EED848 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id CB7B540020A3 for <linux-mm@kvack.org>; Mon, 15 Nov 2021 08:03:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636963420; 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=l/H+oDixRZnd7dOwc6UEzkc+HkILBWlXcmJWYj576qI=; b=MZWKt6Qwkcq4Kn2V95SGhmqjRZ2rGoc8Rx8iclWXVUmnFR3/iw/h9K55J2tLesoChDSgEt w8WbDsvWj48E602OJs0zeuKaXI63iaJrSeXd63Jqn71jNraWixC+Jf47WrhhKMHxZbPr8f R3Q5YWZ2zga4fiuh3/VdKWhkVxrDc9U= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-240-8gNK0gFKPuSGjZfB6_tYHA-1; Mon, 15 Nov 2021 03:03:39 -0500 X-MC-Unique: 8gNK0gFKPuSGjZfB6_tYHA-1 Received: by mail-pl1-f197.google.com with SMTP id p3-20020a170903248300b00143c00a5411so579330plw.12 for <linux-mm@kvack.org>; Mon, 15 Nov 2021 00:03:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l/H+oDixRZnd7dOwc6UEzkc+HkILBWlXcmJWYj576qI=; b=qZKkDgsG16H0vy3K3cb0EsNYyM8JJB1geJ+BgZdGgGrYap8W0r2e88viZyaG8FKUtZ d8xwyDgpGWUNJixLSZRhuNnkwRT/5F9YetGthwCYCPEXfTVtV5/IB5Xqjb5QfeOzsbkU 8yv4fWBlOFJhlv6Nl0i7UR8Njg+Ufju95t2hJ8IetkA6irQkQXhrYFkucz5g7PSfs25Y knayC8kfh/KxTQ/oLvuoTkQIEYsN7Ba6R6tC7CysyIt7FOzWOqXNlA0V06XhT6gecIQ2 Pi5vcCpkEhPhDvniSIpvzFJHRlx1zqOH/Wv0x1ar/LqjtUmUjVislG+zQNJuXCwlM6G1 ocDA== X-Gm-Message-State: AOAM531iXRg5z35GbF0VXQ2z+DtjGH55o+uhIN/bniaiLa7YWC87UcZ9 eZ1a7HhDA2JdmHwGU1A5XztJX6EMe1tpYybVVZekKgm5J5tSAJAwDPdYB4aNlEYF2Lha1IKSPSo 0AhySClknpVKhP8qh2PO08hyUNm5cwupcZHTbjY/aAXr3dP9145R2BpUnDy9c X-Received: by 2002:a05:6a00:807:b0:49f:9a8d:23b4 with SMTP id m7-20020a056a00080700b0049f9a8d23b4mr30974723pfk.71.1636963417876; Mon, 15 Nov 2021 00:03:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7GarKkukoThonF99DLrh9L+TgpvqvwTOsDbfjBOYZ++8KkD2i4+zt+ZNLQP7HNUNlnOJUmQ== X-Received: by 2002:a05:6a00:807:b0:49f:9a8d:23b4 with SMTP id m7-20020a056a00080700b0049f9a8d23b4mr30974675pfk.71.1636963417529; Mon, 15 Nov 2021 00:03:37 -0800 (PST) Received: from localhost.localdomain ([94.177.118.89]) by smtp.gmail.com with ESMTPSA id il13sm15351105pjb.52.2021.11.15.00.03.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Nov 2021 00:03:37 -0800 (PST) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Nadav Amit <nadav.amit@gmail.com>, peterx@redhat.com, Alistair Popple <apopple@nvidia.com>, Andrew Morton <akpm@linux-foundation.org>, Mike Kravetz <mike.kravetz@oracle.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Matthew Wilcox <willy@infradead.org>, Jerome Glisse <jglisse@redhat.com>, Axel Rasmussen <axelrasmussen@google.com>, "Kirill A . Shutemov" <kirill@shutemov.name>, David Hildenbrand <david@redhat.com>, Andrea Arcangeli <aarcange@redhat.com>, Hugh Dickins <hughd@google.com> Subject: [PATCH v6 20/23] mm/pagemap: Recognize uffd-wp bit for shmem/hugetlbfs Date: Mon, 15 Nov 2021 16:03:23 +0800 Message-Id: <20211115080323.75209-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211115075522.73795-1-peterx@redhat.com> References: <20211115075522.73795-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="US-ASCII" X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CB7B540020A3 X-Stat-Signature: cthiymii7c346qiicq793hwqs5tz3hej Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MZWKt6Qw; spf=none (imf18.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1636963420-784091 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
userfaultfd-wp: Support shmem and hugetlbfs
|
expand
|
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index ad667dbc96f5..5d2f73b2e63d 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1390,6 +1390,12 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, flags |= PM_SWAP; if (is_pfn_swap_entry(entry)) page = pfn_swap_entry_to_page(entry); + if (is_pte_marker_entry(entry)) { + pte_marker marker = pte_marker_get(entry); + + if (marker & PTE_MARKER_UFFD_WP) + flags |= PM_UFFD_WP; + } } if (page && !PageAnon(page)) @@ -1523,10 +1529,15 @@ static int pagemap_hugetlb_range(pte_t *ptep, unsigned long hmask, if (page_mapcount(page) == 1) flags |= PM_MMAP_EXCLUSIVE; + if (huge_pte_uffd_wp(pte)) + flags |= PM_UFFD_WP; + flags |= PM_PRESENT; if (pm->show_pfn) frame = pte_pfn(pte) + ((addr & ~hmask) >> PAGE_SHIFT); + } else if (pte_swp_uffd_wp_any(pte)) { + flags |= PM_UFFD_WP; } for (; addr != end; addr += PAGE_SIZE) {
This requires the pagemap code to be able to recognize the newly introduced swap special pte for uffd-wp, meanwhile the general case for hugetlb that we recently start to support. It should make pagemap uffd-wp support complete. Signed-off-by: Peter Xu <peterx@redhat.com> --- fs/proc/task_mmu.c | 11 +++++++++++ 1 file changed, 11 insertions(+)