From patchwork Sat Mar 25 06:56:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13187629 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 C094FC6FD1C for ; Sat, 25 Mar 2023 06:56:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42A896B0071; Sat, 25 Mar 2023 02:56:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B4E86B0074; Sat, 25 Mar 2023 02:56:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27B6E6B0075; Sat, 25 Mar 2023 02:56:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 152E36B0071 for ; Sat, 25 Mar 2023 02:56:22 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D37671A00C5 for ; Sat, 25 Mar 2023 06:56:21 +0000 (UTC) X-FDA: 80606511762.01.25AF932 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf05.hostedemail.com (Postfix) with ESMTP id 6EE38100003 for ; Sat, 25 Mar 2023 06:56:19 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679727380; 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=YhzIK+SVIe9wGe3Pq7eyU1qDg/zViA5meWE6lXYAyno=; b=7Tf6bkUcT7rwDeIbNWdBkwya/ihHfONLGDPWTmZ46bDBUW/MeXX9qcrD8dnc3JyHqvwm5c Vabe++QWip3jkgwUPBpzzcKP6AZfRwpzW2f8GRZRe5ujk48zKU35bt0qi1kJjTx1JfA0h2 IEDZ/bKl54GAWeOhAqC5SCxMhKDYKks= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679727380; a=rsa-sha256; cv=none; b=u2r+oTyy+nMbB1B3MDtYa+Yi0PyUDrD8oN/8TqR5TcWBR+NjJ64/kPnP0v59zEeBsYqh+X 05NHqOBMM8mHiKfLxUjhL68LLy9nXPANlM9I2iWcBTO5DR63IlUa+9JxZr5bFPDIhAdQlo q4OXp5LYHywgwWhq1UMMWJPgVbK4dFE= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Pk8x21GwYzKndB; Sat, 25 Mar 2023 14:55:50 +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; Sat, 25 Mar 2023 14:56:14 +0800 From: Peng Zhang To: , , , CC: , , , , , , ZhangPeng Subject: [PATCH v3 0/6] userfaultfd: convert userfaultfd functions to use folios Date: Sat, 25 Mar 2023 14:56:02 +0800 Message-ID: <20230325065608.601391-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-Rspamd-Queue-Id: 6EE38100003 X-Stat-Signature: iisf8zbndry39mnopuehu6y6wza533q9 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1679727379-893290 X-HE-Meta: U2FsdGVkX18ImKw8AMlH/ncrOO9hBxGLEj/AegKLjT5uyTG7SHl+p3SDrz8HBm4g/Zb7giPLF+yShpiGPQ4xXHRoq8Yt3IlPahiQoZ6yJHvrc3tp0SBWfrwesuIhi7iksCNw6L+DOEwq2YmAaETURQR7QNbHWSPttZ5uqTzZMbDztUJ9wf0kefERtlflJrjoP2xWyAKGLk6hJR5Yj7jdUDIQkVidEyQG52k4UefLX/45WE5tgqQGBpSAtt8q6AEimEHPIbcud2wIHH0wWaxwH1d7orbsRiQpxqf+SF7epM8f+NrBWCTiYWgCMSuu2ONKTjwnN7CqLfbGPyR+cRtzXHSaVIN78kI/0PCwopJKfyZTFE5RZn62dlmEgSzdKBHTFGYAf1pEtOoYF95fKvVEluEbJTqALBXsBpns/KTcZrEPjKWH4OcgwFysaLEH8+krzOr73x+3RcXmDQc9Yk90VEdgJjeSTjS99jLwtbb7CB6vtM7aAHs3SNFZwyikdK13NYMJm6BKhP1TX4HO9VcsIl58RPz2joLaKIJaQvEtPSA/CHLWBSuHh6I27P6jJXGUzCCrEJkou8N87uITSeIak66nVk6rFc5L/KBmvFSaPADPaaZgrBWMoEc31b4Sn6rmee8JP7GXm/QFYVGXdkThtADGlkhMi62x/UlovN2aFxfgbXQNnQIwndJUXt+7cD4TEXp4/KXE3MPDeO+gt/oj1d/ePLC8wAvzH7+z0IIcfy7VLLh0CclmrjaVEq8yqzIUI6Pre91Ub8BPnqH7gHNsSa9h2Vw5woQOfsIIBcWI9KcjdxthKpuS8dPOYrII3ZNAbanbhVgzXnksZ1bcXhSxTEsQAhh//e6NMAC6N3t/mgTmfeOZEjFxEIgjkHdMKLk45KlvyJiqfTsCkmbyPA/i7YGnD649l3UcnRksXzIqtTAYhQwwgYhGApaa+ZCbUbqK3jZ/ZyczEwc8D9EOwn4 nmXWfJqG h0EzYz1jgynDMEtnQbjzwpaq40Ys7BxrKVrQRvXRshaneVbiF6YjFCp0bMyXqJzxGFR4dirzzP3HwHBJw6vKyFmRMdhR9i81Cu8d9dpTPrL+eNivATtpEMuaien9pM4pgejzKpBXcCSgklhXti/ukX5lGuYA3DLf4wuPm38mSFcZ7OIDR6A4Eoi7lDL/GIgKGLOT8d8rPPat9A8CfpLJ6heDUMWBfxRNsbwLgrTB0Wyozu5I= 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. Change log: v2->v3: - Split patch 2 into three patches, suggested by Mike Kravetz. (patch 2-4) - Add a new patch to convert copy_user_huge_page to copy_user_folio, suggested by Mike Kravetz. (patch 5) - Fix two uninitialized bugs, thanks to Dan Carpenter. (patch 6) - Do some indenting cleanups. 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 (6): userfaultfd: convert mcopy_atomic_pte() to use a folio userfaultfd: use kmap_local_page() in copy_huge_page_from_user() userfaultfd: convert copy_huge_page_from_user() to copy_folio_from_user() userfaultfd: convert __mcopy_atomic_hugetlb() to use a folio mm: convert copy_user_huge_page() to copy_user_folio() userfaultfd: convert __mcopy_atomic() to use a folio include/linux/hugetlb.h | 4 +-- include/linux/mm.h | 15 ++++---- include/linux/shmem_fs.h | 2 +- mm/hugetlb.c | 41 +++++++++++----------- mm/memory.c | 64 ++++++++++++++++------------------ mm/shmem.c | 16 ++++----- mm/userfaultfd.c | 75 ++++++++++++++++++++-------------------- 7 files changed, 105 insertions(+), 112 deletions(-)