From patchwork Thu Jul 20 13:01: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: 13320494 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 958BFEB64DC for ; Thu, 20 Jul 2023 13:02:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CAD8280103; Thu, 20 Jul 2023 09:02:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 27A4828004C; Thu, 20 Jul 2023 09:02:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1414A280103; Thu, 20 Jul 2023 09:02:59 -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 017EC28004C for ; Thu, 20 Jul 2023 09:02:58 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C6583B0DFC for ; Thu, 20 Jul 2023 13:02:58 +0000 (UTC) X-FDA: 81032005236.05.2A1B3B7 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf27.hostedemail.com (Postfix) with ESMTP id 2D18140105 for ; Thu, 20 Jul 2023 13:02:27 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.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=1689858150; 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=VoMOxTnnrTWZ8rs4+m1BH19jtkngfSRXW7ZSyIZxahg=; b=TrDiELpysyGmwPgfc5JQKW02FXB5xsL3F7MOYSYZ1jHjf1HGn/N0s+EMgnYnT7rJAaovDe GntkL8gZdMvpkds8qycxiVlVrDtjbqPr3xcUi1haUnmvobYUXK7cfaXeghD0XDY00RxGY8 SSjNa2poURrcTA77Yd+XQr0yFAJgFjY= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.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=1689858150; a=rsa-sha256; cv=none; b=RtxzARl9q+i5V7ps6LLDXFcKrjj0EkHeNQsQBvEqy5/nUEP7B01x6J9fTQUACSjCPplk/c ll9LI+oR60jo2oYHNQ++n1cxCFJhegVaaUkgyvJHR2l00rpMWvziqq+Lve4KsmbyLCzcuf jsR67bYlanzjo9WjNCUibaBv4XprXIY= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6CS44zXXzNmTw; Thu, 20 Jul 2023 20:59:00 +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; Thu, 20 Jul 2023 21:02:20 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 08/10] mm/page_io: use a folio in swap_writepage_bdev_async() Date: Thu, 20 Jul 2023 21:01:45 +0800 Message-ID: <20230720130147.4071649-9-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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-Rspam-User: X-Stat-Signature: 9dbi1uup7pyn1xqarmnpfqqs1qapezko X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2D18140105 X-HE-Tag: 1689858147-715540 X-HE-Meta: U2FsdGVkX1/9p3g01yDPPgcB2ARqJhcE1T2qb/i6Y8kjJRn/IYOFw3uPUNxsqQ8w7g0V3ZSo5ubmb/ahHza2RUzBbRErHa/Km682i9z+WcUC9UuQNgncIk6i7cXVaIPjWYzXdL6akfi9USCIrvcFkO/IwAZ6DK5Atm1jiv9BevrcNh613wWU35iyPGeh2acolTBhPZt32wS7eq+sNCkpWGVJA5vcn7dajs4GUkhZmR4MxG1W9gcDtGyzhVZVXFEdlgnoK/yDOFMJ+Z+SAh62TlIbIuhw0gNiyK3VXLFZAC0/l6NgvDtKpi0mKPX+qGZYzpFzoGoUYoN0d7fSXkI0AgjC/sulIyRnzxfegwkXt9qlIgS8nl/gJxKthqIlqOC8EnH5ew129dj0t4RjD7jI+kabSstdcQR/88sR98stK/6AQTKx31ePfmkhVbJP8vjpOQ4lnTH0NyCCDWZbZBM40vayYHceuAwQU5KjTA3tsrwbABKBSHfR/+gTPZn8PNj0VW73t5xjUdeuiDeVnaHUMQsma5Z+007j4BenY+yC6zMvOfDaMAsKD9UDtgEvhDa8pscQreM/TopAAwtt/rMoEHz+xycn5tx11R52Hj5j3JvUbvFj41FjAcoJLRimVGuvAX+8+eXJhtCrLwZhYX1ycwEyw0crvmnXtlrZl1WEb4tLL2LHEjyHoXVzVX0HIh2BQDM4Xjdn8unTt/bZnCYSg0H+KZvRsV9bKpYq0GK3eay6viANwkDRpOTlEXRmU2wdiSlurHqrTwtSwrIBc5YyIF4P+/CrBSMlZYfpMwjcgsEAV8A+IgGwFKBg7uR2EVM4em/mPOiw1KwOKuF9ka6sTsdxkkOWuMNEZISidxqQ3PcEodVAy1iuKXgfrB2/iMweEFhuZpF4gvybbxyBi4USUYAfCX5xwMj6seB52adurH4HjJ3mq3VYcmZA8RBC+b/YZzsbmTfNTu3f5TtM3h0 oro4JCtE ir2QNNzjGz5qDWYKg0uykXHTmLZZXi1YNia/L8XkDxkAxO1mYFYzdJk1SoNSl3HIXTtATJ4ZWKprAalmbbzUV21ROnhfkRCsMQKpM4cJFs65joYGygpRIMmrTzeTD6Eng7kwz9CTswAAB/S94D6rYHBNblQJidj/H0j2aOB3o3xO07SWUo2W2nLAXG/urxb/oqoShCH4QIV/w18o87G8Es88FuCFaRGtUfIlM8lmoKSHPjTYzWvhVh/MX1g== 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 9df2a85e31b1..07bad3a4b701 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -352,6 +352,7 @@ static void swap_writepage_bdev_async(struct page *page, struct writeback_control *wbc, struct swap_info_struct *sis) { struct bio *bio; + struct folio *folio = page_folio(page); bio = bio_alloc(sis->bdev, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc), @@ -362,8 +363,8 @@ static void swap_writepage_bdev_async(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(bio); }