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: 138094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp318840vqx; Tue, 12 Sep 2023 03:53:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEL3jAflFh+cjpw03h+S9TGiX6Cv6nDU+IowVa3kwbYqALcrWHzuH82cxbY5e6azE3wTB0 X-Received: by 2002:a17:903:245:b0:1c3:749f:6a5c with SMTP id j5-20020a170903024500b001c3749f6a5cmr13495240plh.12.1694516011439; Tue, 12 Sep 2023 03:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694516011; cv=none; d=google.com; s=arc-20160816; b=wiPT7zDaYXPCqhhXkz7ZMVlMomhVsnd0WVnNT4KVlC7j2fyCgMvY4Yjva6LJoSdNma ziVoiw3NnX1WXAPKUTTDfM31fQU3RsCmZntMcun4f7uiYXGKhfrmfyVoG45pcXklrxcF sadf1Objte9uDcRpfXyEv7Z9VvJ9KKMtSDDvgAS8qsuOxXP73SYIveCFCE8QOABmNdIc nDtOpWawGOZmrfw2XZuYrW+G4WxSgBdBVqV9n4Mo+L94uZfnB0BNL3rfx7JFTG5rdnRA kHtPkyihleSFrzRfk4FiyIPmyXNcEUSMK0TOmcrDvbldDMt2Th+JB7+3yoaA+zrMWGHO KRdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=pXTSdbv+8PV/+NU8fLNL59xCumP/grr80RerYO7KEzg=; fh=fwZrSYR8klR3xSdGMINZnPtOQdWYitzcbA6tRPdImkE=; b=Hp0Y8wMcqeEyxTzfnFwNvUhHMAUgfWs5P3q6maU/+yFGoeLb2ZaJNbvLJtrVgwPfFp Kq8fPWlarduEZRA/mEuuIrwOj+RdDqFbA7SiB8n4M1ysUKQHu3uoLVmY0MtC5zNv4QkF jQrX6f40TgSRd7WkyDs8sBjweIqx1Nn16khBVOJm0iwU3KUTxwShz4xvuOzwz4yZfPlW 60QcT7QoGyWXVpegPtixPC4JdoexGirbCOLNCgHtAiUqUN0kpwC5jMWBYldNYEIM6Oe/ AzSXfy3nThBs73xCrarrgd/Va0WAUhg4HbRluST0ppPwAcsc2/LrbhufTri/tAiYtjj1 U0VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u18-20020a17090341d200b001b67bdc438csi5272268ple.376.2023.09.12.03.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 03:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3786F81C0C83; Tue, 12 Sep 2023 03:44:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234302AbjILKoK (ORCPT + 37 others); Tue, 12 Sep 2023 06:44:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234198AbjILKoH (ORCPT ); Tue, 12 Sep 2023 06:44:07 -0400 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691D61FEF for ; Tue, 12 Sep 2023 03:33:52 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Sep 2023 03:44:32 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776828820848385282 X-GMAIL-MSGID: 1776828820848385282 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);