From patchwork Wed Jul 19 09:58:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318705 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 5F6FEC001B0 for ; Wed, 19 Jul 2023 09:59:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC3D328004A; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4B70280045; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C774D28004A; Wed, 19 Jul 2023 05:59:05 -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 AEDE3280045 for ; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8203AC01D5 for ; Wed, 19 Jul 2023 09:59:05 +0000 (UTC) X-FDA: 81027913050.20.818A500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf24.hostedemail.com (Postfix) with ESMTP id 0320B180005 for ; Wed, 19 Jul 2023 09:59:02 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.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=1689760743; 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=05tbuRnTFRinPzP93Bz+bXGAm8DHGnIQ7HSd5f8g8RQ=; b=VNpoggg6KkQ+k5SWxOukgf30KFsMletuPfJEENgoU7JukWej9rz0vLSrHmLezfc+p4dTHe UYI4eeeuaJ0DYgMxVQgLpB0mBlXjNQ/2bs6epm28SYcnmtx5wWbtTr8wtQQrwamwCcu8rr ufokL14+RDNr4QHm+zWSOKQuzTFpG4A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760743; a=rsa-sha256; cv=none; b=0fGIJmPEbQJ+EeDlHj//etr5VG7dQv/1sahCT2TjKROK4KH3y/57K6wr7ISuXUMHNIgYyS 9zFW5MsImcembP0udmr7GzhyDzQ4f7iBXpk71U5nOL88GQaRFjYFEhYgO00IDOezvMdjNY vN5OIdyF+wpiF11UOV++lxk9twGaQHE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.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 Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5WRy72ngzLnsB; Wed, 19 Jul 2023 17:56:30 +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; Wed, 19 Jul 2023 17:58:57 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 6/9] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Wed, 19 Jul 2023 17:58:45 +0800 Message-ID: <20230719095848.3422629-7-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 0320B180005 X-Rspam-User: X-Stat-Signature: rwur6uqxu7xp65tkd6b3crukrtg1oi6h X-Rspamd-Server: rspam03 X-HE-Tag: 1689760742-785173 X-HE-Meta: U2FsdGVkX19YpYY6yo7xNLjtvhTd6zgMyRFNiLGptN9YjNO9aXh8hBNkzqOfwZ6WT1bcpnnvf1MUZY9ZXENdwWTKQny1XMl1AD48733oFyS248F8llAHifJpxxn/3p83rw1EtDGqoVgnstj7mrL/69jeKxPoMY9VTqNq/D9lo3hhR6/rOPonZxlp/US4tOpzsoRIvwrBBAgleiIw3wh2/jkYoMdJ9381kgq3UOkOOaVotl0DLtPEVsFI2vldoICJpozTkuo2gJ9AqxnEu9K4TBrVq60xHnnzlAbY9CkRysjUDVw2rPINBDwC4vjPswbbD0CunMbCMIMXJvis5im6J5rS9pC93hbiFsLiP3ggfq3jLepHxnZ7/PL2eNUoSgExYlg7H5GknS3nO9Fm/k8GEKG+0U92yx9YRAtDziu9XPW6+akmp/OpUKvWZQAjJ1zckg5FEjh+ppwp8vrYnGcD8rbbnZ/WVYXnTxWLuYXvqgowhtTCGPmEzmltsnChBwSZckZal7V6tSlhZGSPWRqPyMQxVwBDn7tNo/TR5QDehp893u1/drmSnwyu2ZOKSYlKAZm4magBfy9IPqSY95JtdSpD4E+SxmeQ3ZWpEMuIxzyNDqsYm/9R0tV6xK9JTyflZPkbhFlF1J1/JrGcaisqj67shH+NhAJijYv7/UI6SR9Id1/6nwHXqHRd9fJOJeOMBJ1aHHp9Xx+Xqm/0mu5A+Ksl9WJahryvTTyB1jsBnXo2ewO622WTU/CICqDhpKh+D2n4g2gtOZTbT1D+mZNpOzE0GLZ9RcSY66I95UgFsBjXAewBT9PBaZr59elQn+sHUyGdjZbdWdBl+W/FumwxslhJ/9+ZInnlovut9h/BAJy3VfZBpztuilA/ytvRrj6mf0PZYe0Jag9DJIRv0SM8chg30YHP/cVwo61p56QoWvJxxOcHtyBRAqqAnOa3kn7Vxq7h7vdrpVtTZ4eCsH5 s1JW3mtY H7guD5uvH0sF/oOsjkCEJXPHXEZx6XeCJj1IxEm4d+tg7wpudjMjmwMYRcAmn9A/JhpWHYkflDLFXiCkEqHCKB4xsjLhc3G9ldcf1DJp04rVlwEXx2sxz0FQa2Q97SXA7oDtHTRwY18hYontmpZOkj5ZN7k3R5n08hOSO5KvwWkrogJWT2NeL86fSaRuNt7klDACe+Bdac1TQk1lwMGfcDlbDmO5wC/O5T6TOWDBFwSnUVvZ+BSdZsEZpDw== 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 92f21f380ee8..0c96ea9dd258 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -331,6 +331,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)); @@ -340,8 +341,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);