From patchwork Tue Mar 14 13:13:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13174412 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD3A0C74A5B for ; Tue, 14 Mar 2023 13:15:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E5A428E0002; Tue, 14 Mar 2023 09:15:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0AA16B0075; Tue, 14 Mar 2023 09:15:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAAF48E0002; Tue, 14 Mar 2023 09:15:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BA0706B0074 for ; Tue, 14 Mar 2023 09:15:39 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8052E1602F3 for ; Tue, 14 Mar 2023 13:15:39 +0000 (UTC) X-FDA: 80567550798.05.1ADC2B4 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf01.hostedemail.com (Postfix) with ESMTP id 4ABE840020 for ; Tue, 14 Mar 2023 13:15:35 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678799736; h=from:from:sender: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: references; bh=si9hMtOGg95glGMXCXd9dx5qnl45eUntxsDhJxfWrIE=; b=i29MVplwZ6/mpP0gqsq7iY3+RvETgfWgZFBB70M7422t9wsDDxiau3o/3TAd7/tzgLIz9P QTTH0ki9MUL4TFDTXv9EcEv0zL2kT7vZshhlsaeUhdbO5/UO0uiQ+nsRMWh9dQ8Qyu5Dvy hiiZGrj1DE7eHoa4iCSQFaAJi7M9Iuc= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678799736; a=rsa-sha256; cv=none; b=GvpDQtRZcZ+ODbdGAPhXT79fNF8XtunmmOW/mH3khG5me9I6Ei7IzzslW4dsiUOs7Voky8 Vi39uPtJ+t/9O2rVhXHrbWEMaxjURFhCl+kBkRgJ5PkSXJOWhg/uJk+Tli3ZimCCutF35S PGCdRZfKPBHlc6F9agb7wBss1Qczg1U= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PbYpm2ms7z17L6S; Tue, 14 Mar 2023 21:12:32 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 14 Mar 2023 21:15:27 +0800 From: Peng Zhang To: , , CC: , , , , , , ZhangPeng Subject: [PATCH v2 0/3] userfaultfd: convert userfaultfd functions to use folios Date: Tue, 14 Mar 2023 13:13:47 +0000 Message-ID: <20230314131350.924377-1-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: mi4hco4nnwuohpu7ba7i488duiyy8d94 X-Rspamd-Queue-Id: 4ABE840020 X-HE-Tag: 1678799735-637725 X-HE-Meta: U2FsdGVkX1+xrf5F+bC/dFOmlY+Ogq8axGeknvCcR68HhDAmol2qmyTXbBf88sgWiGsrrbWSYVO7ssgrdrGp2/4AMxf4WzrmLvQLmM/k2uqIRJyyAFNZSymLNGwwRkLInIyUnafgwaeYnqPUch4QSijVrvh1K7xWtUaHRoUDcAznnZZR857e3RQ3ZyRdki6m+kwqGqQI5wjL7QWUtMrnerYfh9SRARrYNE5Wni/DeWgCBjlfiymAiX+e+sH6yDF34iGTqC6qVIvKUAnnMWVpLkM/WIfzaREkPAW7IAODE6bbHZubBP4o47gtpx/UIVZnpBMfRZNg0qwJL+tKGD80xF2aaiE0TXDbwA3q1IcpusLAgcJ63+RG96CzvDeJ9B18SXNUk8gHk2I8DCv+vRYfr/eFleQi8BbeiagyJbahbe9V4NidzzEZ3C+0Pw9KFxoazg29fIdhH3VG/Em/f18OigaUaTeJ+VoSShShDhHE8hHSJSJvxpV3oJPPcxeDAyarPz9qgB2opo0II1Vmk3AqZzUbCu+YmbKIYWMKNNj3cGEmS9zzGWxgbU6YCQ1DaswWtEB4bbjjy85oa0OM+oJ1nDh2v/0Rp60PmvKZ9k5xpFRsoFqWmX1k3kPDvFU0ev6aIuHkgdnzYJXxdOrLG661YAnsqOra6Hqi2XMfg/fn+PCyCmSCvSpmOv72Cs+QFb8Wtu+ucUBG8oZj0OrQhE5VZztXWu4G3/tme1CZ6Fou/jAwjyLXX/pT8TCcfiwEVWswCrQYVd+kPXi8Yrmhpo1azh2CaKYuREIpHOWxidkB9QGPnTAQUChVdBk6lIBI+kIw9dvLun0IBBFEf7wkQyjdsC93wkLeYms5CNRAeexTFlWrg+9QkcBW/s1fdt8wgImp6R1iF9OGej6xaGaLi1DzZNdAvU2RbQEnfthRhacy1a1Eb7FIFxLzfj3emDSysuJsbmUVWvZzNUQOiQQZvsF XMTfMdXg OpObt+e/md6ZvBJ9y7WjRumjlTKUi5+cIZWBSR4dZHgt13OxFZBS4xnaxOb2EhJbs8m1lp9c9MeLotV860rzO9g1iXAHIl28ffbVXCNV/6aHbNye/MJsGrRpstgOsGXK8025ilVMNP5b1JRPjP8xfVDjFF/H8eG3vhgKq5iDotvyfsQdFdyYxzanSlfORcOFmFa1/jARvSX+aq7i0U2lbSwh+9jEIMMSl60PS9k6PIRYyJEM= 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: From: ZhangPeng This patch series converts several userfaultfd functions to use folios. And this series pass the userfaultfd selftests and the LTP userfaultfd test cases. Change log: v1->v2: In patch 2: - Rename copy_large_folio_from_user() to copy_folio_from_user(). - Delete the inner_folio. - kmap() and kmap_atomic() are converted to kmap_local_page(). Use pagefault_disable() to ensure that a deadlock will not occur. - flush_dcache_folio() is placed outside the loop. ZhangPeng (3): userfaultfd: convert mcopy_atomic_pte() to use a folio userfaultfd: convert __mcopy_atomic_hugetlb() to use a folio userfaultfd: convert __mcopy_atomic() to use a folio include/linux/hugetlb.h | 4 +-- include/linux/mm.h | 3 +- include/linux/shmem_fs.h | 2 +- mm/hugetlb.c | 25 +++++++------- mm/memory.c | 27 +++++++-------- mm/shmem.c | 17 +++++---- mm/userfaultfd.c | 74 +++++++++++++++++++--------------------- 7 files changed, 72 insertions(+), 80 deletions(-)