Message ID | 20220304051708.86193-21-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 3AABCC433FE for <linux-mm@archiver.kernel.org>; Fri, 4 Mar 2022 05:20:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFFF38D0005; Fri, 4 Mar 2022 00:20:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CAE808D0001; Fri, 4 Mar 2022 00:20:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9E278D0005; Fri, 4 Mar 2022 00:20:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id ACBF18D0001 for <linux-mm@kvack.org>; Fri, 4 Mar 2022 00:20:06 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6508397909 for <linux-mm@kvack.org>; Fri, 4 Mar 2022 05:20:06 +0000 (UTC) X-FDA: 79205552412.25.6AB075B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf22.hostedemail.com (Postfix) with ESMTP id ECE62C000D for <linux-mm@kvack.org>; Fri, 4 Mar 2022 05:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646371205; 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=VZsj8wGvJYP0Z35VYck5GXCqHSNO5FmtKWCwc6ZUvEE=; b=UJQepTws6yabS8ug5Ts25tQrYW1BqvZ3Idju22QXYfWR1JEf4VDYnv0HdB6ZyRVi3BTnxW 5EOY8raYm2f/IF61O+UasqgfdugmJQufpRz8gtcn69AW6AnUuqvzwG69Ib8Za3gG4tCKRz 0Ic0J0LAoHH65qwVr5ByrB3MPrijgng= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-572-Yv_RW60yOC6x2k42yuv_AQ-1; Fri, 04 Mar 2022 00:20:04 -0500 X-MC-Unique: Yv_RW60yOC6x2k42yuv_AQ-1 Received: by mail-pj1-f70.google.com with SMTP id w3-20020a17090ac98300b001b8b914e91aso4197796pjt.0 for <linux-mm@kvack.org>; Thu, 03 Mar 2022 21:20:04 -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=VZsj8wGvJYP0Z35VYck5GXCqHSNO5FmtKWCwc6ZUvEE=; b=KwqJy5S9xBQ1xUfQUpHVErl2QwAUnGx+V5eVk3jNgA0x/mhaRSodG4UbfdXMJ53HHV VaZRiANv3G6sfdekLpJlrleJWmrfxf2VDsyrSd+m+ryhHn+huaPe/buZm0EJfY7Y3uSs D8Ih94dFxGWsz3LHRj9ijL7cm8Y4F2VcDWOtZNMhr/GwC0orvVDpHE7U7q1eb6+yBqGq pQ1Rc3QVcH69UUYAPMnhAosC2iI1f8H+nPzxASySVWi4ZXwDGDDaojeIduh143LsNFT6 /nj29UNASHfbV1Kxy+0sp0J24kBMntqSrh/jNgqwqtmGU29pSz1oYVTCE/WG5r6GDFpJ 2TmA== X-Gm-Message-State: AOAM532hIQuy9b2x3K/I8GdU1VvgGcn+vUdSPA0xVoSNNmlKDA2hnNY8 ouhEFm8vNI6P7KHRNFYafS93AHo1D5P7q77zKv5kDUGeSFADU8J1DTka/Wtb0KgkNbehoofGgHQ rWcnO/OVtMbwYAUopfZpXYmc76SfUWQHaQXqbdcMd+Egbx/y1NeyFbkIwDJZN X-Received: by 2002:a17:902:6b47:b0:150:80de:5d49 with SMTP id g7-20020a1709026b4700b0015080de5d49mr34640530plt.77.1646371203361; Thu, 03 Mar 2022 21:20:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJw05sOycQa3nYtvDYuzzS5+ZO7xhuLtA37+jl2qgXReyHL11C3e1uJ1D5StzvLh4AArL9JTNA== X-Received: by 2002:a17:902:6b47:b0:150:80de:5d49 with SMTP id g7-20020a1709026b4700b0015080de5d49mr34640498plt.77.1646371203014; Thu, 03 Mar 2022 21:20:03 -0800 (PST) Received: from localhost.localdomain ([94.177.118.59]) by smtp.gmail.com with ESMTPSA id p16-20020a056a000b5000b004f669806cd9sm4323865pfo.87.2022.03.03.21.19.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 03 Mar 2022 21:20:02 -0800 (PST) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Nadav Amit <nadav.amit@gmail.com>, Hugh Dickins <hughd@google.com>, David Hildenbrand <david@redhat.com>, Axel Rasmussen <axelrasmussen@google.com>, Matthew Wilcox <willy@infradead.org>, Alistair Popple <apopple@nvidia.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Andrew Morton <akpm@linux-foundation.org>, Jerome Glisse <jglisse@redhat.com>, Mike Kravetz <mike.kravetz@oracle.com>, "Kirill A . Shutemov" <kirill@shutemov.name>, Andrea Arcangeli <aarcange@redhat.com> Subject: [PATCH v7 20/23] mm/pagemap: Recognize uffd-wp bit for shmem/hugetlbfs Date: Fri, 4 Mar 2022 13:17:05 +0800 Message-Id: <20220304051708.86193-21-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220304051708.86193-1-peterx@redhat.com> References: <20220304051708.86193-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: ECE62C000D X-Stat-Signature: b75968n3xmnssw74aqb7trewm5tdmgy6 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UJQepTws; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf22.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-HE-Tag: 1646371205-227939 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 2c48b1eaaa9c..46e5896b82d2 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(+)