From patchwork Thu Mar 30 13:40:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13194190 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 334C4C761AF for ; Thu, 30 Mar 2023 13:41:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17DE36B007D; Thu, 30 Mar 2023 09:41:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D555900002; Thu, 30 Mar 2023 09:41:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC8F96B007E; Thu, 30 Mar 2023 09:41:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C34C76B007D for ; Thu, 30 Mar 2023 09:41:37 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8DC9CA09D1 for ; Thu, 30 Mar 2023 13:41:37 +0000 (UTC) X-FDA: 80625677034.16.93DE1EF Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf21.hostedemail.com (Postfix) with ESMTP id 6283E1C001D for ; Thu, 30 Mar 2023 13:41:34 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 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=1680183695; 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=qsaHUhQFumn0HkhomT7Ue1ksmzrEMG6UCLAbCyVvh5g=; b=BBOmlF8Of/5NmhxXvopskFCAdy5wBlaDqUfN/aqgT8lOD56HXbR6bHTf4DydlJD7CTDME8 BSfZPIS9NLmr8JVb78a70yIMap0ZAxEZBIoKx6QBHodWEv60+V+SV2HwB69kMJP2SRhn1k 0U3DybEDouXJgpx6J2beLOanXo/wM6Q= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 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=1680183695; a=rsa-sha256; cv=none; b=PEXBBo58CMw8DuekbPqvP7sDKV6E5F6tgDR+rbJ5LoN7ABbbO6RsQ8pMlYygifdeQ03rcH axPhoSXgJDXpvhctiQskpBINRlviTqGwWBINBuXLDOK/o6LjCDiMFksHiem9MvqO6KJTjp KRV4i1Shnrcnz6GPw3bgcTx2cB2VA9s= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PnPcz0htnzgZfb; Thu, 30 Mar 2023 21:38:11 +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; Thu, 30 Mar 2023 21:41:28 +0800 From: Peng Zhang To: , , , , CC: , , , , , ZhangPeng Subject: [PATCH v4 0/6] userfaultfd: convert userfaultfd functions to use folios Date: Thu, 30 Mar 2023 21:40:39 +0800 Message-ID: <20230330134045.375163-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-Stat-Signature: z7r817o8y9wxq3wu1d3keq5iy8i6fqts X-Rspam-User: X-Rspamd-Queue-Id: 6283E1C001D X-Rspamd-Server: rspam06 X-HE-Tag: 1680183694-8485 X-HE-Meta: U2FsdGVkX18rxkOLo4sZP1WuFFJ22mGvKYBbGI3emKvrytJrbRqajY1cAUEMre85YUv3vPFe7mcLaTRCxKbqsxpb4sxepk3axJLU8WxBVeRpPrjcOnTVgbGp87V0nG9U/Sp2hSxpEWb8yKyQaDxUZw0iAZ0tDJpLxVQhdv/BR3ZJu+fHIWWew61BBKnbUYoytvHOfCVkUAyfODaly1Dd2oeM9YzyfqCHsXFwzpqa8+4KVzLpS4oSAHRfCkpjq7EmwiT5UCL1SJdo956OWzFCJOkFHLIwct294kW0KZTr+9I+Ckl6IGAfSi3eegnj8A0ipLBAgT8hXB7x2qUCFC4KNaMhOg2Nw/UgnSMcRhB5bfFi3v34GvLrGHcmKXU55TO9Quq2MRrIHuBWrWT9aEi+diKPtpdl3fpTTFIwzzSJvivkHbsTh5ThF0SrHlLgGWddJpAxkCsx6pxYcUPYuWiSzY+42eaDeYoWES+YSq7qme+COFMT8VpOruA313tEF0BFvDNzG9Smvsl6s+xyGvV0AgoVYcFrfkfxvXLZN+HAjZTj3WOrJ6jRXOLeskBj0mMeNVH54ZxWHBOIh1oxVTPzul6SdqdDrNkgIzY244zrm33Myk1KDaezYVOXgF5PW9pUVTKw/nq214mWj5RtVWncYLxea8UxznRoc6Qck16aW0lo5pP9EA1C95o8QbUYuy054p3ZpXqro6WCKYBIn1YeZW4BzxPOeHRNMdkVYkUuxW1g0khZWQlx1+tgEZhhua5Ml+8fm9SSAxSy4xG60+TAAy1Zbyt54H8h/efAOIH3eEBU2EnBlMFEI2I1ZVfFExiyCi4ImgZuHJJd5OcOQOtUORMVJgkuhb4f+X0VzgE4qkd0g1Y64X6ecG9CSV5dIG0fJUEHrx90XSCdfQHDmTKyshBPuq2rXy9KWx3VsppImDmHs+lY0KibjSh2ad/hUxOKifZ6z86g6fl72pIQM8n Lul/4bnt n8NcsjhBOI1h6LN3gEKDhit/4riNmj7xQHAZwUQVgh9Q4nOPpsW4EeT6irVDBFje+ymuUddy5uxWCk+T6nngGQCwPCIkocg+PdvWQGpkpSkT2ER4RxnBfOXef91ujQXjby4Sm/5oQeo6+h/nWklvdjveBhMCqteXliyFs5YUfKKiNJ61YNBma6r7h5qyRogttymRw3aFdrsnDfgB2Yz+3XzCe0gB5O6wKVnvMItrnm93QY4U= 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: 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 | 15 ++++---- include/linux/shmem_fs.h | 4 +-- mm/hugetlb.c | 41 +++++++++++----------- mm/memory.c | 64 ++++++++++++++++------------------ mm/shmem.c | 16 ++++----- mm/userfaultfd.c | 75 ++++++++++++++++++++-------------------- 7 files changed, 106 insertions(+), 113 deletions(-)