From patchwork Thu Oct 17 14:25:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13840112 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 C1A0AD374A1 for ; Thu, 17 Oct 2024 14:25:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C7306B0082; Thu, 17 Oct 2024 10:25:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2755A6B0085; Thu, 17 Oct 2024 10:25:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13CEA6B0088; Thu, 17 Oct 2024 10:25:35 -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 EA5A56B0082 for ; Thu, 17 Oct 2024 10:25:34 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 40AAE160466 for ; Thu, 17 Oct 2024 14:25:22 +0000 (UTC) X-FDA: 82683317304.29.72CDDB9 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf12.hostedemail.com (Postfix) with ESMTP id 8283A40016 for ; Thu, 17 Oct 2024 14:25:27 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@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=1729174986; 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:in-reply-to:references:references; bh=Yi+5gK1rApMY4/8Oa9oyCh+yPv9cwbEHrMDvuHfg/Ys=; b=GYPhTrfrZJnWlEgSekEuzyYINhEj/0XL0VLqTXi6zWB67crUuc/xcXa7a5bX7gZFWx5M6/ 5XXYNaYX4DXrtnR4nX4h9zOX3KSbk3BpE5Ub1hSjfRA9D5sLGX+a45enJFEPyOXWJQ6h6j TjNZ/7hOTmVPOaUHePLGKeTKTSaIcSQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729174986; a=rsa-sha256; cv=none; b=XWpcZw1p/rNx4tIsT7YYrdOvtmnS6Z1fZD3/zsA+gHX91ycDWbKbUXEReDwc16fsG8U0bC Tf2PdO2l29jJQD8lJHmqGPTTtp8uc2f2P/CLTk4g9qWwmPYAIQLqvbDkAJ5RunP3exr40B LqI+K7B8e43+DzWz1Ax2WaZLs5d+3Io= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4XTqpC1mtPzyR99; Thu, 17 Oct 2024 22:24:03 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id 6BA0F140135; Thu, 17 Oct 2024 22:25:28 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 17 Oct 2024 22:25:27 +0800 From: Kefeng Wang To: Andrew Morton , Hugh Dickins CC: David Hildenbrand , Baolin Wang , Matthew Wilcox , , Kefeng Wang Subject: [PATCH] mm: shmem: convert to use folio_zero_range() Date: Thu, 17 Oct 2024 22:25:04 +0800 Message-ID: <20241017142504.1170208-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241017142504.1170208-1-wangkefeng.wang@huawei.com> References: <20241017142504.1170208-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemf100008.china.huawei.com (7.185.36.138) X-Stat-Signature: qyc3h59ke5reiiakrttheu8ndix46x4x X-Rspamd-Queue-Id: 8283A40016 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729175127-596297 X-HE-Meta: U2FsdGVkX193gd/+WOmk7sRGwXGwX5EIYxrrt2ZHGQKJPRKn6Bz/mfxo96+flCtK94+6+KKnfiz5P+yehsxc8keuUUJKTQU1/uOdqTF83B0pIHzddfLwVa+6RXQvqOavU2wKcOWvNHeqEncxPfFV0eh4+h09g2XB6+4/zsnzgEGwqOd4biYUqqnJtZ7QY7gVdeIpQMT0ASkwBi1jvwmQAA4DjcjkA2/BJAx65dyzqsFG/Z2i/09G9n2emmdqKfublELo0cDuWaEo6kxkIdTw+y4BMDhIkeldSJgflwiegpmQqWh2L9gjOGdV2RcHiPhNi3/gLQHTuU91RgLHdcuUylW5+sO99iP9QTEuFq2oaag6K3wxNGuJJV66WSTmGs34ZilzgDPfs9y0v4k0j46/f+CYrAsRporZGgx60SRH5Q4KzmgYdn8zsvDz5TkJ5L44Eh5vHPooEmvh2rk0xvLyqxgkv49HRHa/f1Df19Cxo0Y+tTC/tyCvn43OvE6JyPNOd1aAU2oP/hS2VGHJVcP/OoO7DIELRYTPvuWGy6E0UfmlWIcTKyrgAq9eB69NEjb/iOlruGAkjn4vyQvsNqmQRKCL/vaxsku5B4ciSh1y/FprOuZpl1OoAmQZrA6DfgkXrUr18nbPHeecT4Kcm4+GPWYLTApw0IW9WqqAd3fC+/2c/+fwTiT+QJGf/QX5BF1sc49dS4Z4Rm0A0fnSGKMJ/aoOtg1UnZ+jYkHuwYrQPx6zN6rFoPZXsZOEU3cNuYTtC2yJDp1xVw/eMI8BhP6JfUYg4RqgefZ5YqkXkxBOzdYfSevCTwtiP6VUviYkYeRB9aVM+lWxTmw1K5C8KzWJPdX9SDwRuM80Twf6Ys8VGvL8ht8UU1GgJxuekpMCN+p6JjZCpHDC8MN/YAeVlNjJSvclJQfR+Fugrk/iC5aldnirZ+K5NKqnDQEwEX4DBRlvK+4fMhWNzkMG2uHFMre 1XGuVt9F 1lQ1KWx1YzXMKKPbq7Tk7/owUwGV5qv+KB2kh38D50yT1FVoE2mnx890cCqL1rogFWaOwMvS18yS/QCgV612JWSafhl63jK9fgZo2O0YzObffJ2yvmVOZf/y40fEyqdx+f9vQH3gEKqxEuKI7cXi1gaDSdOWLb/HMhoCi3f863kO63VpacG99dnmayx1z5vF6PgKM 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: List-Subscribe: List-Unsubscribe: Directly use folio_zero_range() to cleanup code. Signed-off-by: Kefeng Wang --- mm/shmem.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index bd5ba016567d..247c0403af83 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2392,11 +2392,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, * it now, lest undo on failure cancel our earlier guarantee. */ if (sgp != SGP_WRITE && !folio_test_uptodate(folio)) { - long i, n = folio_nr_pages(folio); - - for (i = 0; i < n; i++) - clear_highpage(folio_page(folio, i)); - flush_dcache_folio(folio); + folio_zero_range(folio, 0, folio_size(folio)); folio_mark_uptodate(folio); }