Message ID | 20210714222528.49296-1-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=SYtF=MG=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 X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFF9BC47E4D for <linux-mm@archiver.kernel.org>; Wed, 14 Jul 2021 22:25:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6E8B3613C9 for <linux-mm@archiver.kernel.org>; Wed, 14 Jul 2021 22:25:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E8B3613C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BE9486B00D8; Wed, 14 Jul 2021 18:25:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBF9A8D0003; Wed, 14 Jul 2021 18:25:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A39BE6B00DA; Wed, 14 Jul 2021 18:25:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id 7F8AB6B00D8 for <linux-mm@kvack.org>; Wed, 14 Jul 2021 18:25:35 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6BADA1E4DE for <linux-mm@kvack.org>; Wed, 14 Jul 2021 22:25:34 +0000 (UTC) X-FDA: 78362626188.22.535B45E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 1B1CDD008A73 for <linux-mm@kvack.org>; Wed, 14 Jul 2021 22:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626301533; 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=d+qr2gkGCf8UGCRyFBArhsHy6tP5+E2Jys4dwvbHGGg=; b=OOL302q5CRWEHDYqPbP47jWi/wgopq7PEtMf/Y5BMDwbhKgQYudqsbaEfaxMDJ6Hzp1QqD bLVYQWUz4dGup9KInI2JMVxtPcz6oQvLvD03ZpcjlkvQK7Rt0YOmpi7dv8pITaear14dYR owoyUDkp4d7dtAODZB8/w1M/FYR+kuA= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-Uk75DobDMymV4aAuTX-lAA-1; Wed, 14 Jul 2021 18:25:32 -0400 X-MC-Unique: Uk75DobDMymV4aAuTX-lAA-1 Received: by mail-qk1-f198.google.com with SMTP id y5-20020a37af050000b02903a9c3f8b89fso2332203qke.2 for <linux-mm@kvack.org>; Wed, 14 Jul 2021 15:25:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d+qr2gkGCf8UGCRyFBArhsHy6tP5+E2Jys4dwvbHGGg=; b=FeXU1wnmykw34DqJG/uFf/vc/G2qqpCE966j8fYOXQVcOV0Qeg5ASoiDqiFX1jXC9X qPO0L3udtfj+82i++iPCDzkUXa4ldA30DMPff3XkZ8ndQtmrdEykWck6UnaSW9deTCFw hVs6Rj6mNwIFwx3EXrHMaAKkPrrLmSHpYWCX1cSxZfJEfP2IoUO7H8CsIyVmGIvZYdlc 1wT/VVg0BzTzzp+AMdIovIXEVQ0k2Sgt4Fdh/1gKTxjA/Ot21w/7jFJqzLF4ISzWyyIB 6tShiLEGpA5b+vAUzJR+CeqOEP3w4QWxr9cB4zQ8XsdQPdOYQmKt8zpV/zjc1Yt8m430 NtPA== X-Gm-Message-State: AOAM531RHX+yC2/W8MZUymzwylib/SOEgSs0rRbKMsP1xYWBcot8resq Aq6gtm9UMUZwy4bldRexOPn1NnHfu0oG21n/W4evEd/awjvNnuO9P/0wiRlXW+6F1E5STrlFcLN fa/NzvJwE/EKFUTZxZR4qkAZrn4qgLHbSemlHob99ko2ZL30TKj/D/czEiBMM X-Received: by 2002:a0c:f850:: with SMTP id g16mr231027qvo.5.1626301532015; Wed, 14 Jul 2021 15:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMAg8OaJDdVqZ7CGPKyUVwq/ziIAcVf370Zekn0zY8Li1Qe9olZ37NU65OmsJDzDU/U84feA== X-Received: by 2002:a0c:f850:: with SMTP id g16mr230995qvo.5.1626301531801; Wed, 14 Jul 2021 15:25:31 -0700 (PDT) Received: from localhost.localdomain (bras-base-toroon474qw-grc-65-184-144-111-238.dsl.bell.ca. [184.144.111.238]) by smtp.gmail.com with ESMTPSA id e123sm1658706qkf.103.2021.07.14.15.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 15:25:31 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton <akpm@linux-foundation.org>, Mike Kravetz <mike.kravetz@oracle.com>, Axel Rasmussen <axelrasmussen@google.com>, Miaohe Lin <linmiaohe@huawei.com>, "Kirill A . Shutemov" <kirill@shutemov.name>, Hugh Dickins <hughd@google.com>, Jason Gunthorpe <jgg@ziepe.ca>, Alistair Popple <apopple@nvidia.com>, Matthew Wilcox <willy@infradead.org>, peterx@redhat.com, Jerome Glisse <jglisse@redhat.com>, Andrea Arcangeli <aarcange@redhat.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Nadav Amit <nadav.amit@gmail.com>, David Hildenbrand <david@redhat.com> Subject: [PATCH v4 24/26] mm/pagemap: Recognize uffd-wp bit for shmem/hugetlbfs Date: Wed, 14 Jul 2021 18:25:28 -0400 Message-Id: <20210714222528.49296-1-peterx@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210714222117.47648-1-peterx@redhat.com> References: <20210714222117.47648-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" Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OOL302q5; spf=none (imf21.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-Rspamd-Server: rspam05 X-Stat-Signature: suguheb8r51gixtrpf8zjxpy3t1wbewt X-Rspamd-Queue-Id: 1B1CDD008A73 X-HE-Tag: 1626301533-241227 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 9c5af77b5290..988e29fa1f00 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1389,6 +1389,8 @@ 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); + } else if (pte_swp_uffd_wp_special(pte)) { + flags |= PM_UFFD_WP; } if (page && !PageAnon(page)) @@ -1522,10 +1524,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_special(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(+)