From patchwork Fri Oct 6 06:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFyay1QSyBUc2FpICjolKHmspvliZsp?= X-Patchwork-Id: 13410968 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 06AB2E92FE7 for ; Fri, 6 Oct 2023 06:03:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6776C940013; Fri, 6 Oct 2023 02:03:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6262194000B; Fri, 6 Oct 2023 02:03:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4ED7D940013; Fri, 6 Oct 2023 02:03:41 -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 3F03494000B for ; Fri, 6 Oct 2023 02:03:41 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EA1C912027C for ; Fri, 6 Oct 2023 06:03:40 +0000 (UTC) X-FDA: 81313995000.29.015CC4F Received: from mailgw01.mediatek.com (mailgw01.mediatek.com [216.200.240.184]) by imf18.hostedemail.com (Postfix) with ESMTP id 3358B1C002D for ; Fri, 6 Oct 2023 06:03:37 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=syw1zc43; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf18.hostedemail.com: domain of mark-pk.tsai@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=mark-pk.tsai@mediatek.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696572218; 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:in-reply-to: references:dkim-signature; bh=G6RcZSK2ZXZNwpAYwk74iwfftVFpwiXwgGnN1wemDVw=; b=5hxiB8tH215lt2xhMnoNujITsAS04yEbwLHPaInqSZIuf00XcjqrFmyuJrvlCA0hFy/QiC YGKgHmup1FOkOAbZiRYY+zj3hZmgVCcxdXpajY2KXZhNXxim5Nt6+kwnmWhGR4h65T66PE 94hhdF9K0xCc3/b/LokjNkYD3f230ck= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=syw1zc43; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf18.hostedemail.com: domain of mark-pk.tsai@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=mark-pk.tsai@mediatek.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696572218; a=rsa-sha256; cv=none; b=hdAm+lKOrLtX5tzNa7cJEf1EwkNQmSOx7Mf0KQyUnZ4xkTVx7ekewPhZehuwQY9DprgISa GXID1sztLrd9gkDqNi/BUQLTfC6tHkLWAvZmabTCtWqwZih8WXP8raCDoNuPs3H3pCVVRa OHzab+MPYGeH/V49VK0yS8n7GMV11Ec= X-UUID: 116b3dfc640e11ee9b7791016c24628a-20231005 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=G6RcZSK2ZXZNwpAYwk74iwfftVFpwiXwgGnN1wemDVw=; b=syw1zc431l5KIJZODYIQi5CbSTVuN9t949ZwOquQStJcrQxqfM4dyAyBTlMRx4DHMvK6x1g01oGFVwgYGgkSLRBgQ6jhIsEPNoJ5NFDqVBL2Sggb2CZ+a39x2PZh5SddFk0zTLVqWHwWgBgKZjpdLcu9/UL6yVYa5/aANyBpjvE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:5c83cd7c-ca47-4d36-9858-c1f682660451,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5f78ec9,CLOUDID:a39bbf14-4929-4845-9571-38c601e9c3c9,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 116b3dfc640e11ee9b7791016c24628a-20231005 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 227494627; Thu, 05 Oct 2023 23:03:27 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 6 Oct 2023 14:02:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 6 Oct 2023 14:02:50 +0800 From: Mark-PK Tsai To: Minchan Kim , Sergey Senozhatsky , Andrew Morton , Matthias Brugger , AngeloGioacchino Del Regno CC: , Mark-PK Tsai , , , , Subject: [PATCH] zsmalloc: use copy_page for full page copy Date: Fri, 6 Oct 2023 14:02:40 +0800 Message-ID: <20231006060245.7411-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Rspamd-Queue-Id: 3358B1C002D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 5qqxit7kd47484s8kpawk31ib79x4k57 X-HE-Tag: 1696572217-678977 X-HE-Meta: U2FsdGVkX1+Q1XkF7UpCaQF/N9Jc/qg7BfWfI+y5v7PHd2n4FnR/z3MAkgaG4l6C51Czqvod+W1pCcPJPzO2vDrh3+IAjCNLm17iX/nSZsJNhmYrsw/6ohlG6w3ok4r97BToUARALdK/EXZfJYH2pkYOCbBUuJnIUcaNTURe2Az+A98d/IJI5pFXP7/QO9vzx0jHqzfG3iwYxdIyOfEMXjwVI/VRh204hc7uJ66GomPhpvGcYjmixTts8PpVbz3RuG9X2Ywb9NMbmbChAcyqXlNxFUQCPIb3WMt6Qf4ZgB2v89ggZzt/ys3r17UHBHsu9K6joGYMWu/k1gLjnsLnuC3CElTnLsm7N6SibWGJ3etperh3ijK9KvKOyZM1un9rusD/3LH4SRIR9K6M7KomT/+Sh49S2BHZ9tRaS3SIbzZ0TGk0J1SrAAnbgNtP7PPZaNBGfZBO5dtEU2x1nDXWco68xJvDahPZgHRm0KW+EeuyrA3CUbU6Y8l4vdhv74FCfbuARm0DASqn8t8wAd/n1pzYSTgeLXbgogeDy5WhaEzoQFadJBsYqX3eAY0vaFfCNOlNbaNdNMSjOMk5kvg0dyvaY5UbEAfmtLOLEbuwDhxk9KqeMha7KpBEGsr1GXQOJdz1x9bdbYQ77eKYSSAF0C3KP+uT8TxBcQH13mAdciiGLtFCMN6J4+trKEY9ciE+vS3mEU7vw9DN0TxD+CH2CcLMabiXozcmaOxi3oNXOv4jR7eSMYrRducyLc+SJ1VK3TSkDkrGJJgxBnXi86leX2EHByB8gJBLtCI1j4DCP1s2VGIjteDIHg+AyZ20bsu35y2dzTrT9LF7iim/oS3bPnny8K51lmI2ON2Qv0Mw1vTfEDLmNLRSETHvkaA2jGWUQ3WWOEJwv/7VoxhfVJxyZFCP4VE1So73Q+mLX1xFqqHjku0roeuF8i8vopPTi+SAVjjDwvG69nHWdh/oQrn 7+bi19xI XXbAlI5ktEy6HSWu0cUfZPkCQqldi+8K3UI16D0U8tBA7kYVAHpWRyvqPzxxA31vxhI4i6Y76qPuqCLcKsqVUMk03JftcCUADaZhqwZQEtCuucl/bRNd7t+LV6Z2za5Av+rdRF4UgScyOboK0ryJ6PqZxISQefa65qYQqb1UWN59E1i4OXSK2WLnwq0aggzJGiePJ5iRBcCfVu72fUoIrRLTYRWzaY4gZ+RMtZa6FmYXIokM1JT3XN9eq+guS0q/TcvE7p7xyjbMndp+YDqsPCodbCSNSkeCh1bTh 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: Some architectures have implemented optimized copy_page for full page copying, such as arm. On my arm platform, use the copy_page helper for single page copying is about 10 percent faster than memcpy. Signed-off-by: Mark-PK Tsai Reviewed-by: Sergey Senozhatsky --- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index c743ce7a5f49..b1c0dad7f4cf 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1839,7 +1839,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, * Here, any user cannot access all objects in the zspage so let's move. */ d_addr = kmap_atomic(newpage); - memcpy(d_addr, s_addr, PAGE_SIZE); + copy_page(d_addr, s_addr); kunmap_atomic(d_addr); for (addr = s_addr + offset; addr < s_addr + PAGE_SIZE;