From patchwork Mon Jul 17 13:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315707 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 CBD8EC0015E for ; Mon, 17 Jul 2023 13:26:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3210A8D0001; Mon, 17 Jul 2023 09:26:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EF4E8D0005; Mon, 17 Jul 2023 09:26:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF3468D0006; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C13A08D0001 for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8E56F1602C3 for ; Mon, 17 Jul 2023 13:26:18 +0000 (UTC) X-FDA: 81021177636.22.5D5641D Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf07.hostedemail.com (Postfix) with ESMTP id 96A184001E for ; Mon, 17 Jul 2023 13:26:15 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@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=1sq7sILf+rIS36Fm062bRML42UHcoJOwmUD0+cxBZK0=; b=ouHxj04S9XxA9q0dRomtn82YYxmhCNb57pNDpb31tKUOsdilDSws4yiSEpFNfE2Zk3msxh pNsnfXbo+zE2YBtL78wYesu2Tyyzguz5hZD4exeH9wi/QG6uw4LgXAtTezQAFtwQDOrP3V 1tH6aeLkZJE1qHIirh0O4lx4wJY0dHw= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689600376; a=rsa-sha256; cv=none; b=3LjyZ118PTN7Z14stbarbpYkphLrTiwd/uKeQNkH4X/yD+QshYllyHQoVeJPo2RzgrMPuF JvSe8+utAsq2qmwECiZPkn8Sn04EF85NpfXIiSD5LZYos+8DUorqxQk7gBp4++qqJRJZDQ Tfz+R2ZgEf9Ib40Ztx/QupVtjSHNieo= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R4N701MT9zNmP6; Mon, 17 Jul 2023 21:22:52 +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:10 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 3/6] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Mon, 17 Jul 2023 21:25:59 +0800 Message-ID: <20230717132602.2202147-4-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: 96A184001E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: prhciiwrw3yh1uzmwyajexpuybzyb6jt X-HE-Tag: 1689600375-909502 X-HE-Meta: U2FsdGVkX19s1EjcAUIDCW/zCY9OpXgtybhiVfXteQGaIgMWmzl2Nk/9mchvUkk7zwNUfnEbLqT39FSy4A02bdua1ZQpBth+IEL6tehT4gFP32waTmfDsWeVu14aqW6uKeCsS4x/9wkB9n5ZHqQhUKnI5pgo6chj6dhxwnWiVfWQZG9DBG4SBuCnbZtx504JuUj84jPccSlR0d2NcvkleJM8jo2gHw9dBMZ/cZ3fAxmtcRMNqaSQ5ISs1hKUReq5OsDdghJTGjxdcDMfksOardKE/NqjKyMjbfCMwiwVp25DLCIkPLLJqhTGI9uoZxfu1WY514skjNWuuXtRbmhJd45Lvg0L38ayagSHbz2MzFnf5WCA1337f4WmYAQNU4qYXHxObdMtYBnC0z6x67Ktcq2mE2xQc8WZvnhPIQnPkhnH/SljowEBUQkFlRfAAFy5hDUruB7nhI6rOjNCF1EQfo0/6KxWzugZfQkFSHVaPYG5EJ58cNXocU8EEUlNAN7Vtc/EHJzc/zrx9/Wnutf0lqBNJYqg1rRJ7NGq89+TLFsgRUXTe8sd2XM2aM/Pf3BGJipKvc078snew/Q6FXXtOhomEyUIevBBofvEgMb2Pb0aHW7Cm++6EK2ePsaGPhkoV5JGUfYgclZ4U1p+BvdefCqMOdyS2uaHvfo1OGf4minOmMc1ya6P2IMFuUbrVcgUyWyGB4RTlpjKPqlHdHKyq92ovaR2u38miqJUnWlOSHn+Kzlag5gQby8iMii+V+555GGhlBiw2aQQItn244BrIkdkMHoR5uDhuZjei/Sy2ShsnQIMlpBL72VL30f8DHlO6KzFpRlfeYcroIWZokVUikydLmIuL49o0vGSShHxKtydYx2mC3tE663pWQjUzZV1CZ6AZy/oKepfBJF9BOzrzw9hhTG1LT+fnprY5/sLdvq8YrYhwqZs+MU4JcYvXHcb41TIx0vN/EWPay+IVK1 XlSxcERk 45Nhoyzet1AAE52t18gT5xAq47hQIR6YW/nahT9pJ493UuAkHkXKAKhaN/vrysqtmsqQMUINYSCbpoBIJmFPnT2C4CVyGTLKzVYcdDnv+o6MRETsA1Y3mh9l0ZV5InGLm3EXmzlfaWr2vdbKRLQgALeCWbApFt+/CbHfYlSdxsQVDuerTf0JLeX5L099fdTet8PP2 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 one implicit call to compound_head(). Signed-off-by: ZhangPeng Reviewed-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 438d0c7c2194..f24f814b8dca 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -334,6 +334,7 @@ static void swap_writepage_bdev_sync(struct page *page, { struct bio_vec bv; struct bio bio; + struct folio *folio = page_folio(page); bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)); @@ -343,8 +344,8 @@ static void swap_writepage_bdev_sync(struct page *page, bio_associate_blkg_from_page(&bio, page); count_swpout_vm_event(page); - set_page_writeback(page); - unlock_page(page); + folio_start_writeback(folio); + folio_unlock(folio); submit_bio_wait(&bio); __end_swap_bio_write(&bio);