Message ID | 20220405014923.15047-1-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DC8BC433EF for <linux-mm@archiver.kernel.org>; Tue, 5 Apr 2022 01:58:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7243E6B0092; Mon, 4 Apr 2022 21:49:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D1C56B0093; Mon, 4 Apr 2022 21:49:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 572F36B0095; Mon, 4 Apr 2022 21:49:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 48C536B0092 for <linux-mm@kvack.org>; Mon, 4 Apr 2022 21:49:39 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 23A79230ED for <linux-mm@kvack.org>; Tue, 5 Apr 2022 01:49:29 +0000 (UTC) X-FDA: 79321143258.11.935563E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id A468E1A0007 for <linux-mm@kvack.org>; Tue, 5 Apr 2022 01:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649123368; 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=kYLbDoazIMJSeMNhJ5zt7FEdCu3V+kUqTKXo5M6GV7A=; b=ffku4zq6o80U0U8REoBh++LK7eoeaJIaMYmYaIqCANc4lZrCRVrWYFE5Fi+QaylXojCmVa x6dtmJLF2VGX6IorklobdMjY3/iNJ0vAIb/lw1McJpnB58Ff5XgXRR4IJaYxrTogqhsJmq PBICQkwFeZf3L0rneRQkwwTr/Rp2D1g= Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-183-nHgLutAZNT2thDbBk8QRQQ-1; Mon, 04 Apr 2022 21:49:27 -0400 X-MC-Unique: nHgLutAZNT2thDbBk8QRQQ-1 Received: by mail-io1-f70.google.com with SMTP id g16-20020a05660203d000b005f7b3b0642eso7397912iov.16 for <linux-mm@kvack.org>; Mon, 04 Apr 2022 18:49:27 -0700 (PDT) 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=kYLbDoazIMJSeMNhJ5zt7FEdCu3V+kUqTKXo5M6GV7A=; b=fZsSTBMh4xpNVs4Pnhl7EI0G9E10XShubRenpJq7Gn94SOCgzuCokUNKmFLwGNJoNP cdP6bZPX3yOJ8ToMjkFqrzeNbtHEbKSULG45JLINd/NFZd3t1uma2wkxTOYhVZ0HHFRr OtWl1WVSJbnWfzQ+c+TlXOmAQd6F+nCycxEHaz6LjCdx/nl7pK3TLh3mgSf0aZc7UuKH XouSNdcj2g71U+M1u863o/+TKUMFPNRICd+AdP4gwtIFBddP2JO9rIGri2Zxq8z9y64J y24kt+bM9fGbJM/ivTESR0yX1ZDNfr8qQSFbiYzg20vZPXyocHjeLsKvOLYERzUo7vku Ekqw== X-Gm-Message-State: AOAM533Sw4qsw0iMY4ac3fzmKDPDn/RPfExPM1aDhUROA+AguVuOJLRk HXSyaugvhiTHiURVvzPDM0XpnIEzmyK/oMmawdCep38wo+4mjnfjAFPUol4we7r9ojPYTciFh9q XIU3xiuFBjoE= X-Received: by 2002:a05:6602:2c0d:b0:60f:6ac8:ad05 with SMTP id w13-20020a0566022c0d00b0060f6ac8ad05mr539101iov.175.1649123366484; Mon, 04 Apr 2022 18:49:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIt71qNBgRyuVjW7pMNtAgATJ9MNf0M9CvhTW16IXYsjPRDdAvOlDVVqXJGfZlYTfnSe8R1g== X-Received: by 2002:a05:6602:2c0d:b0:60f:6ac8:ad05 with SMTP id w13-20020a0566022c0d00b0060f6ac8ad05mr539087iov.175.1649123366302; Mon, 04 Apr 2022 18:49:26 -0700 (PDT) Received: from localhost.localdomain (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id m9-20020a0566022ac900b0064cf3d9f35fsm2767620iov.35.2022.04.04.18.49.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 04 Apr 2022 18:49:26 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com>, Matthew Wilcox <willy@infradead.org>, Mike Rapoport <rppt@linux.vnet.ibm.com>, David Hildenbrand <david@redhat.com>, Hugh Dickins <hughd@google.com>, Jerome Glisse <jglisse@redhat.com>, "Kirill A . Shutemov" <kirill@shutemov.name>, Andrea Arcangeli <aarcange@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Axel Rasmussen <axelrasmussen@google.com>, Alistair Popple <apopple@nvidia.com>, peterx@redhat.com Subject: [PATCH v8 20/23] mm/pagemap: Recognize uffd-wp bit for shmem/hugetlbfs Date: Mon, 4 Apr 2022 21:49:23 -0400 Message-Id: <20220405014923.15047-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220405014646.13522-1-peterx@redhat.com> References: <20220405014646.13522-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A468E1A0007 X-Stat-Signature: hga761brttkoehrb544tkpegamydysqa X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ffku4zq6; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf19.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-HE-Tag: 1649123368-800099 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 f46060eb91b5..194dfd7abf2b 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1421,6 +1421,8 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, migration = is_migration_entry(entry); if (is_pfn_swap_entry(entry)) page = pfn_swap_entry_to_page(entry); + if (pte_marker_entry_uffd_wp(entry)) + flags |= PM_UFFD_WP; } if (page && !PageAnon(page)) @@ -1556,10 +1558,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 | 7 +++++++ 1 file changed, 7 insertions(+)