From patchwork Mon Jul 17 13:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315706 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 EECE3EB64DC for ; Mon, 17 Jul 2023 13:26:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05DDF6B0072; Mon, 17 Jul 2023 09:26:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB80B8D0001; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0C8B8D0005; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 899476B007B for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5B5E4402FC for ; Mon, 17 Jul 2023 13:26:18 +0000 (UTC) X-FDA: 81021177636.25.B68FB81 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf30.hostedemail.com (Postfix) with ESMTP id A6F7C8001C for ; Mon, 17 Jul 2023 13:26:14 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 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=1689600376; 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=V7vHzbTqeW7JilGe8vNV9ImKVDt34goczj++N2ksBns=; b=RurQO+pV3RU6zE/FzARPXYfZx1/bpTo4FG3UOPujhOtaeK7xDbZlD4GwVaBDkwOxISb2sk WYzI7A/NVw4beAds5Y6D555X8ODBWo/M25ACjtT47rXDPsRWZJfZUnAAjLxwKIjwCd4ZrV zeSTZONv5hL4sDv4LYFLcF6KtiO0HBY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 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=1689600376; a=rsa-sha256; cv=none; b=0R4LglMVpZUfmSLf1qwRek5U3+3T2unS6pDS4K556qmc+lgF3n9fwZlIH/aKele1yMSeKp mFZGOPzhyjoeHDHsU1VYBjZqKfsZutP6fTlc8GnUf0r77ujQL7iuMHkRhWz0SGbqBvaKLF +oLpNXCP//UUcGApuK+72B5ub2HZRvs= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R4N810KhdzLngj; Mon, 17 Jul 2023 21:23:45 +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.27; Mon, 17 Jul 2023 21:26:09 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 2/6] mm/page_io: use a folio in sio_read_complete() Date: Mon, 17 Jul 2023 21:25:58 +0800 Message-ID: <20230717132602.2202147-3-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717132602.2202147-1-zhangpeng362@huawei.com> References: <20230717132602.2202147-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: A6F7C8001C X-Rspam-User: X-Stat-Signature: atysj36k4ndmfm4tmhybeg1gp4kwax3z X-Rspamd-Server: rspam01 X-HE-Tag: 1689600374-189069 X-HE-Meta: U2FsdGVkX1+iHEbhvNtKMUNPIVqfgsloXUThugUgIxPZDqKpG35NSCBYFI4AS5El65gMwdnhoAwld6dUReyE8m1uNeilHNhDMA+IgwLiR62DOMEdsUBc8uRjprficiN9xoB/7/ejCZHF7nu8Ph4Ng5PnP+c7sVZYfgYSBhD97+rYokOhRAWo8aRtNLpzaBZ5G4/HLPl3UDv3foHrwUxEYmylqnvYh26ur0rcIBBEZT6RHtjQQm2kaseBQxu/F3WhEVsckA2xul0BCaWBZ7WYETzqZplYaHpg+aZBUywkf3EyWBvbDof1rBisyCXXGlsKhP+QLId+j6bV+jajGTx1OcrxvUE9T5Pv9l1cml7h4vLtb1FrqzmT6DG+sCAA60bEdYcKYrQprN9csFsNPKbEZ1R9DH4DZAqMfHZdDRQos9H7AahBDAPvPmUt8yOiYeP9IDpcMOoRdTjrJOY31LV+6On1l8M2LthxmDQUitzdTaaerexTfOcw8SQLMIPtgdE5n1lTkVT0agVvP/UgH6O9/3q1irEpMvGxZeTjDdyCtoSg4xKUWUNDsvKmt4bRvY200t0YuHqSpGS0hofQaro9S6G8UZszfwHipx66lwIcdhyeupslEgJeKy8EFxmS8vKClgW2hUAwMNNBVzrjLJxRzULTtoia4PibAMiwk0qJpkj5pORo8Cq29OWwUd0icl/05lb9PYj/X0DfstuY2+N2VqmSsakYPlKjFMTEenXVTe1C4zIv9/B+pdgdCvPBw1ZUEnf6wxPnvIm1EDnDYmuMPbpUrpOkqVRBVNUWaa7ImU0LmB8u3iv8uIlCVXVybGkat5sSSUkv9SMKTS31dV/0yyG5iHuKuu1zPpLq/CvVRYf+Rw/iCEBMgDu7AvzrOhyiWuqTR7jr1jJdDnh0bN5pGVWqE5NEI1uNaq3bRSsz1optypEUSlIlsdSbHW6yH47uXY+Vl2tU3Z3yhTHRcgO bmGx7YOW VyGvUm38NHKPw/HxiwfOEm1DqvtX7wgOsrbMQv+uT8HZ/RyTOwVaFjNghKrnPgELXKnOSY4UshcN4IP4Bd7mfTNCbS3raTz72kXj/xWHFPlaVmzba95SJ0jCUD1+dIrBpf9rdRYZI5uWIAWRAbgCwiMgqRQ70e4H/jxfhTOdAGX5OnLSqX0fBy948WLVibXxKWsq0 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 Saves three implicit call to compound_head(). Signed-off-by: ZhangPeng --- mm/page_io.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index ebf431e5f538..438d0c7c2194 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -406,19 +406,19 @@ static void sio_read_complete(struct kiocb *iocb, long ret) if (ret == sio->len) { for (p = 0; p < sio->pages; p++) { - struct page *page = sio->bvec[p].bv_page; + struct folio *folio = page_folio(sio->bvec[p].bv_page); - SetPageUptodate(page); - unlock_page(page); + folio_mark_uptodate(folio); + folio_unlock(folio); } count_vm_events(PSWPIN, sio->pages); } else { for (p = 0; p < sio->pages; p++) { - struct page *page = sio->bvec[p].bv_page; + struct folio *folio = page_folio(sio->bvec[p].bv_page); - SetPageError(page); - ClearPageUptodate(page); - unlock_page(page); + folio_set_error(folio); + folio_clear_uptodate(folio); + folio_unlock(folio); } pr_alert_ratelimited("Read-error on swap-device\n"); }