From patchwork Mon Apr 10 13:39:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13206368 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 C8215C77B73 for ; Mon, 10 Apr 2023 13:39:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F247C28001A; Mon, 10 Apr 2023 09:39:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EAC27280002; Mon, 10 Apr 2023 09:39:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D259E28001A; Mon, 10 Apr 2023 09:39:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C2D06280002 for ; Mon, 10 Apr 2023 09:39:51 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9AAA38025B for ; Mon, 10 Apr 2023 13:39:51 +0000 (UTC) X-FDA: 80665589382.12.AE36449 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf03.hostedemail.com (Postfix) with ESMTP id 3853420019 for ; Mon, 10 Apr 2023 13:39:48 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 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=1681133989; 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=Ctv/Gam2oAT3qPYp6CiaHA/4NNK329XchPejLcIrfVk=; b=rjdNZmhV2u+wqg9Q8xbwxQ7U3Hk8skS6Ky/LR7EV1onjmhiN+LvF9ol0AYTHMP12h1nRHT xTdfbEkkXYA4UY26hLYhdn/smJnVzItY8xmIq+lEOn7e+7miwibkNvbU6iIN1tjsMC1Vx4 ySUFoX6AoBRmqV0Z/S7eI86s+/2GtRc= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681133989; a=rsa-sha256; cv=none; b=tCJDKLwNJdq6ChGQbB4Bl3CALzn+YHif6zbfwcub132fx1Am7++lAZIUAVEQZp+jDPbAJY kaykk3t7tTx6W9pvOOdT+PNjPBbCDSvTKK9CthBQ+dPLIUU1NWhfXeaZp4wJaAXPyab+G3 2uWymhGYchXoL4fv7OkfPXrI5jkC8nc= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Pw9364LnPzSrKD; Mon, 10 Apr 2023 21:35:46 +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.23; Mon, 10 Apr 2023 21:39:39 +0800 From: Peng Zhang To: , , , , , , CC: , , , ZhangPeng Subject: [PATCH v6 0/6] userfaultfd: convert userfaultfd functions to use folios Date: Mon, 10 Apr 2023 21:39:26 +0800 Message-ID: <20230410133932.32288-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: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3853420019 X-Rspam-User: X-Stat-Signature: jmfu6afyfr81xjwzr78777wcm4ewya53 X-HE-Tag: 1681133988-520529 X-HE-Meta: U2FsdGVkX18s3EUcRVdSsw3cGxVrUNZnfcVxsqUwUsM2e6QQR92PqkFzLNAprxsjQueCFvfivspV3z9Vv3bPBiaOiHYTSJOt/76ECe9ZdIkIPJgTrjWcl8PG1JPKski8CIiBAlpV2bKXDvsyjJVF/eIDnkJG1sqdIWIxEipiKkcPbnnjr52VyJfl66z7tuE1gpwjYQusfslod7Jg82h1ZFp9YedqAncQX4I0uGKE0nLVScKPhm0CBg4evamrpKF+miCgL/nsofeY6C9hCsBdexl2PdMkevuEHj3gd7L7C6+pNlCcKCxsBnSSt7E1pHH7QfNI4mhftmBak0HlGA3uYYEIYxUzVIGS11YSKp6yBPYyNa9s1b5nBUXVFZObfMHtNzZAYn86LYi8cWRkOQwDQFA2o2lhzvhkQtSVZvW3WHZyvSPk9R0e/+wuGr0czSxTA6C/RtOr+Md1bN2vDuUVr0WtmbaY7JTYzU8s5qD0KIMqGfZtLjUl3aRFLgQy2ZNJskJ/LCeIygL9/+EggKdJIzZ3kbg2/qGF8SAXcI2FreatPYmO9YBguXEx/P8loXwDLGRXz4qu6fmk54c4xaiXr4uIbq6jdJd47M/etoYoRam11VaujVYVhoVZb4z43wjM0MI2ZiYXWM9nyrtfNS4kT6EQi3nfaM6zq7GaNj41t2htsQE11aP5KKwKsTbAeLkpi7k7ie64BA2xa0bm2xxMxPTvI+wkUPdMFYZzM7M8q4t9ewlb2dAWS/I2NOCUX63BBuXZe59h7xSHRoMtJYKyowxKp7iiXZ2+QKMq/9kD3uy86lySN9q/StR2QfFla3pQI0uuCXfvXt7eX4MyGqHfQj5oNGyEiK9lbqYdafX6EJthNDEyu3KoYoue/M2KaNUz4INOZnFZ2gALuY2m61KgLo2EuB6ljguVFYZ0nTx9DYNwXhjCHWeJGXn+H1QueUYgAZPptnnEwAq0twUAy9N RMfRxqZr /j9+0izRvq1MYT3/t93eqLSQHQrAnYJLDxuLHjwjWmPyNDDvBN1gXvneWcOzrU3c6NOwDYQEiIB97J1koGbeeetcnYzFM+BGWaHHwxQmAhXw3lOjiolt8NymWeJFAUtmcDklrPwcnLBrJgwg/obXo2iGMjRo44dAmkFmeceqH1+/mqirOYL+FRldGw9CRDBshjFzUDk164q3qqQY0Ykz2NawYQ6OIfPuZnBMnVDz95pMxVck= 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: v5->v6: - Remove VM_BUG_ON_FOLIO from mfill_atomic_pte_copy() per Mike Kravetz. (patch 1) - Keep flush_dcache_page() in copy_folio_from_user() to not change the behavior of the function, suggested by Vishal Moola. (patch 3) - Rename copy_user_folio() to copy_user_large_folio(), suggested by Mike Kravetz. (patch 5) - Add RB from Mike Kravetz. (patch 1-4,6) 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_large_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 | 40 +++++++++--------- mm/memory.c | 61 +++++++++++++--------------- mm/shmem.c | 16 ++++---- mm/userfaultfd.c | 88 ++++++++++++++++++++-------------------- 7 files changed, 109 insertions(+), 118 deletions(-)