From patchwork Tue Sep 12 10:33:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 13381361 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 A218CCA0ECA for ; Tue, 12 Sep 2023 10:34:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1FBF16B00C7; Tue, 12 Sep 2023 06:34:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AC2B6B00D6; Tue, 12 Sep 2023 06:34:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09B326B00D8; Tue, 12 Sep 2023 06:34:26 -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 EEC806B00C7 for ; Tue, 12 Sep 2023 06:34:25 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B8CC9B3E93 for ; Tue, 12 Sep 2023 10:34:25 +0000 (UTC) X-FDA: 81227586090.27.3C9FF80 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) by imf29.hostedemail.com (Postfix) with ESMTP id E47B6120008 for ; Tue, 12 Sep 2023 10:34:22 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf29.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694514864; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=pXTSdbv+8PV/+NU8fLNL59xCumP/grr80RerYO7KEzg=; b=LPL4YDt5z2z7LHF1NHu34c7JVZvBEe4aXa1aLI3QXyQP2CQzOrmJskdfzBHpth70XPC9la BjPrrhn4yPtpKmB3ddsHS82aj9hokagduW8xdUeeErNin6quymjGZKLn4cWGKGVZnWhfg2 PG7EKE44n1N8e/aXot2oc817uCuO2Zs= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf29.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694514864; a=rsa-sha256; cv=none; b=iwsz5zE643sbTFmiXV4kXS5KB4ejCfyX3Mdk/jludUd8p8SFbFB3M3KFeeyCo6UEHLjhhY nlZfIC2ksZXUPh0bAgEQ8ypiKeWCpJpcaCxDcgnYNvDIov7zQPFSv1artXkGGpwrZQV1Vt S51SHrGlzw5UiALQjtZLp1QgHaDRurc= Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 38CAXdTP037668; Tue, 12 Sep 2023 18:33:39 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4RlKbw5wGxz2RsNTk; Tue, 12 Sep 2023 18:30:36 +0800 (CST) Received: from bj03382pcu01.spreadtrum.com (10.0.73.40) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 12 Sep 2023 18:33:37 +0800 From: "zhaoyang.huang" To: Russell King , Andrew Morton , Mike Rapoport , Matthew Wilcox , , , , Zhaoyang Huang , Subject: [PATCH] arch: arm: remove redundant clear_page when CONFIG_INIT_ON_ALLOC_DEFAULT_ON is on Date: Tue, 12 Sep 2023 18:33:34 +0800 Message-ID: <20230912103334.2074140-1-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.0.73.40] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 38CAXdTP037668 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E47B6120008 X-Stat-Signature: g1peff6bfssb3qmtxob4pd765otgw9pm X-HE-Tag: 1694514862-727685 X-HE-Meta: U2FsdGVkX18lD+IPW7BvBUPx1Gj+ajZjHh9ptL+uFImTfW0qRWWKSgGd7e1tQGWDOtN2+ozEJI7Wb/nd/AMR3xr54ZL8BdZ8kgYoyUrYUbxMrzYsygnAQKtB2lfzDyDLNG4c6r0+3Ht98yZa/NFZSH+UyeRz59gw/ZRwgGEvvD+volDtQTN+mMYKy9quA4EAgcnDZsRcjMJj9JV6ri7dHc9/CWyDeFvGCPdtjygQ6VUomt8TjG7OYK37MwIHoHPOuDWI4BTzkbuTNyb14u4PO6gu6ZkxQv2lz2jFtMtLqHCb+BQZDb8B5yYEALnKkhEmok4jaU1pVCg2rkne9U32KwdTH011Up1kvygbl9kgQyz6t/C7rcs3MBAT9l89RndOlhckrF29uNDCQk0H8ebOCbMNbz4qVKE82CNxwurmCUE77rN/LuMLp7vrgxAIieXoVCru70QpuLL5eZc1UruGYQVBcII2SllU8FOUINf9M9Mw5dzguxPTTw7yH6c7DrgRfmPcYF4uX/JM2PUggV3FuCrUr+ymL4eS6+qaEX4XWsnTXVebkUniapOY0E44XAHWSKl9mr3Yb4iyMXkI4qCFa4W/gH6/mro4li9xEt6f++vm3RfVN5Vvj8wd+wxvjIrqfE5T1N2eiIG+lXuRORn7zIXg87f0qExscBncX1v5+IrNREvDq4U4xF6w8CUNHVMNsPPsCVtTYtbwgizeb+eLVwR1zELeMLQ+RigBCpg/NjL/vh+NFGEKh/qUcQTWVwsuJWU9LL8ZzI49FcHN+lphOLiTJaG0Gs5hK6dZfOc2HulZQas/beGEp0hlU8GZObkmwIMPsL2BK7qE5Db3LVzqi3VQqpWQaAYCHOtSFcISVenQMVC/kdGfZsSHhSePCaws3WaXwVp5DyY0s4kjiXO9FatvDMC0nyRBN2daurGAqcVXElZu/WhmnghdKPqXH5q1FsUWerK36AopzSYKrXj O9uTHkFY tBZdC3Bjk1PyXAc35AeLeIwOwjj3+hMJPQ+6wRSqMb6m2/fQhaK1sNNW4+CS1l5Wo9pBj39BHYMy7zZhE3YELPM+5xvSFusKh6b+TSKaiJIpSg5IR1KGB3zIJrsy+yOIbXg9hyvgjoO94smnzSQ9nT4/MKnLsOLq5dm219k48WoOtoe56a1bPZknJg0WOldZAWtjI746jhLQzz8PmKKEERGLztEfFV+Huh9WrYUJ4Yqem28lc34IMoONiJ5+aD7jX9YzGm+JSzM23D8ZCkrjhFBpExlM/Egxq4dAIMIrJGzpoJeX+rjKmk4s986x8gj8b1xF2t6sKunzZ4++7LP+SkJR9xZ74jR1cXWXO2lzQoAX2yyBsH3L7d8orhlEYMB2Tui1C 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: Zhaoyang Huang Double times of clear_page observed in an arm SOC(A55) when CONFIG_INIT_ON_ALLOC_DEFAULT_ON is on, which introduced by vma_alloc_zeroed_movable_folio within do_anonymous_pages. Since there is no D-cache operation within v6's clear_user_highpage, I would like to suggest to remove the redundant clear_page. struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma, unsigned long vaddr) { struct folio *folio; //first clear_page invoked by vma_alloc_folio==>alloc_page==>post_alloc_hook folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, vaddr, false); if (folio) //second clear_page which is meaningless since it do nothing to D-cache in armv6 clear_user_highpage(&folio->page, vaddr); return folio; } Signed-off-by: Zhaoyang Huang --- arch/arm/mm/copypage-v6.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c index a1a71f36d850..6f8bee1b3203 100644 --- a/arch/arm/mm/copypage-v6.c +++ b/arch/arm/mm/copypage-v6.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,13 @@ static void v6_copy_user_highpage_nonaliasing(struct page *to, */ static void v6_clear_user_highpage_nonaliasing(struct page *page, unsigned long vaddr) { + /* + * This criteria only help bailing out when CONFIG_INIT_ON_ALLOC_DEFAULT_ON + * is on. The page has been memset to zero when it allocated and the + * bellowing clear_page will do it again. + */ + if (want_init_on_alloc(GFP_HIGHUSER_MOVABLE)) + return; void *kaddr = kmap_atomic(page); clear_page(kaddr); kunmap_atomic(kaddr);