From patchwork Fri Mar 31 09:39:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13195693 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 156ADC77B62 for ; Fri, 31 Mar 2023 09:41:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A0AD6B0071; Fri, 31 Mar 2023 05:41:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4281C6B0072; Fri, 31 Mar 2023 05:41:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EF746B0074; Fri, 31 Mar 2023 05:41:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1BAF16B0071 for ; Fri, 31 Mar 2023 05:41:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9BA07140382 for ; Fri, 31 Mar 2023 09:41:55 +0000 (UTC) X-FDA: 80628701790.12.67158E3 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id 8139D4001A for ; Fri, 31 Mar 2023 09:41:53 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 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=1680255714; 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=hs3Nd8jhojQCp2OX7nf5xbSLn2Mlfo8+mikOZ/Dosm0=; b=oZ9rp23jORpzb50F0TzkU/UIB9CZxyde0FxoGDuxkyilta1ct0UC8lZ4EiDdzdr5LCSj/S BRQiQUNUXCCiwDlvwIhM0dWS0G82f7J0YREXEEffo5UZJu0DRkKzzCcf4Isd1uqm9uOSeO OaEydKaloLF88VnRJ6KA/bjUB4RCFFQ= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680255714; a=rsa-sha256; cv=none; b=KI3RiKi9PDbX9mppFyrUfFeQDU+JOomL1U6lzMf5stqxsk2mR7habpDkvbrrDhePdGHZCd HyFOIhLhrzBZeC2tme/hMA3tNlOFrO5+QD1JON2sTFTzpeSDi3PLjn2L6ERbR/HxFNsl5M xo4rZroel3q+NGTR2z4z1hLhUvGgMDU= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PnwJQ00C4zrYS7; Fri, 31 Mar 2023 17:40:37 +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; Fri, 31 Mar 2023 17:41:47 +0800 From: Peng Zhang To: , , , , , CC: , , , , ZhangPeng Subject: [PATCH v5 0/6] userfaultfd: convert userfaultfd functions to use folios Date: Fri, 31 Mar 2023 17:39:31 +0800 Message-ID: <20230331093937.945725-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: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 8139D4001A X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: jdtyqtgxyjytbybgr75x3dwq1r8egat6 X-HE-Tag: 1680255713-152801 X-HE-Meta: U2FsdGVkX1+Sff0Hc8q31nJj+hdkQENeyFq8mUGB/zA6ea7ik1wtRse9SEdybcW8FKZY/W5kfzSjXjRTDEJ+clWTK6CCPE1NGTrxgyEh3tcvTeRuJKsr3GjKlh+eJFIMrwEVYg4z6cwcNQaYeQPMslgzlhmvQhLw6Hh0ecJbGVqQlwwTZHBP5F7FROC1WiSA0brrF7Cvh4tpyduXEtvvqz/tMuZFVXCEND3fmPWyjoMCZxXYM5lsNM+ThIudUzstIJt6d+AUjoQLJKXKhPGa+rywH9UU8mTEhFIK0EHNlL3+5d2vkw+35aHVgRT4lBWvPvFD54JHE9OFr5jvd4dUbG6j11Q0ccV1mR2sEQQsGk6JAeoUgdmlULn/EarbEGrxvacN5gx10sJy7yvhc+3RZcz9LMXtfYZDuYgAYOarVIxkm84UTBv9+tIfef6ctqO3xFuaUalGmhQgyfxOcGVgE/zZ/T2sXO6H5znkPF2tGtypmWSPgeu3tKlWFAwKo32MxunuYKHl2jcg3dsfTChIeyQOcJf5nZ9gtZz2Qef8fPA/2E9rIqiKvXf1AsgAKIkiak8L47BA3GPM9iT+NX6KkZ/dRvJsZWtXNTbTW1bP4NlM2DT1TuV3uufwMwHj1b8mjX9oiJpozDpgvoQ2+yBOIIAJl/2pQJu+pSCknYukBWdpM2Q5HizzYObUvpk9zu0o0D7ugOTD4BDzMhbWwghEN5wklHd259NRKovdAxYWAH8NCjARI1tyg5nMpd3zQy3Mo+97cjWRp1NwNuFpvRHyeF5YnFF3SA20GbY0owlIAC0OM8cnNuIxw0/w+tysIC+kOxi+mjtceon1eZZG2kG+wfAO8oYbNP4fPimLgbpKdD2G8S19kCcfaCsGFV3Gq7j/xAezISTHhHL7/n2YcdoBbOlNAfxUEkLhoE0Nny58TmfDvVI0J1GlkmFVp5ZrUvuN121689PYfGvXuAo0VLm nd+2knYt ibsM0BMlQ6/iZDYl5i250HC4YHXUEzHnOis7xsMyMzYyZ5ljs3c8Is/f/dGySGI0foqQoRKvzhZdLokmNHKLZmgb7tEhorgvd9mDJUMiva40T/KSD+qajaziXXWvXhe1gU9dC7KuqdA70nXppFNHlsF8MNPutl6RkFpt8LmguDfVimS/eKJrictPOWOpv37v2Jc66+8tbAG3MijjDTYzGqgUVY2x4w8h+uVWV4hIDZwVBPQY= 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: v4->v5: - Update commit description and change page_kaddr to kaddr, suggested by Matthew Wilcox. (patch 1,6) - Remove pages_per_huge_page from copy_user_folio(), suggested by Matthew Wilcox. (patch 5) - Add RB from Sidhartha Kumar. (patch 1,3,4) v3->v4: - Rebase onto mm-unstable per Andrew Morton. Update commit description because some function names are changed. (patch 1,4,6) 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: Modified patch 2, suggested by Matthew Wilcox: - 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 mfill_atomic_pte_copy() 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 mfill_atomic_hugetlb() to use a folio mm: convert copy_user_huge_page() to copy_user_folio() userfaultfd: convert mfill_atomic() to use a folio include/linux/hugetlb.h | 4 +- include/linux/mm.h | 14 +++---- include/linux/shmem_fs.h | 4 +- mm/hugetlb.c | 39 ++++++++---------- mm/memory.c | 64 ++++++++++++++--------------- mm/shmem.c | 16 ++++---- mm/userfaultfd.c | 89 ++++++++++++++++++++-------------------- 7 files changed, 110 insertions(+), 120 deletions(-)