From patchwork Wed Jul 19 09:58:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318706 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 5603BEB64DA for ; Wed, 19 Jul 2023 09:59:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFF4028004B; Wed, 19 Jul 2023 05:59:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAFBD280045; Wed, 19 Jul 2023 05:59:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4FE928004B; Wed, 19 Jul 2023 05:59:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B6E53280045 for ; Wed, 19 Jul 2023 05:59:06 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 87D8EB079B for ; Wed, 19 Jul 2023 09:59:06 +0000 (UTC) X-FDA: 81027913092.15.6F23F05 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf27.hostedemail.com (Postfix) with ESMTP id 3B3E540015 for ; Wed, 19 Jul 2023 09:59:03 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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=1689760744; 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=UVTGk7uE48dHWx0qiOUJ1sysC+jsNAeG55w6ywd1FnI=; b=fxJrosnexVfG/QSqV4ADVkJgwxnHl23dr/7TfSuncPLGTpSW8ZdMiAyN2I4otuVQC4Ovp2 M5qcePsFp+ZgH/Y4NBKO4dAHdn7PrvKVTQaOxGg3GAPWS2Xga7lO0sKxnBxcoq/WUMj7jm uGpDsRJC+HjDJT1BBDzTLQrk4Muh5xA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760744; a=rsa-sha256; cv=none; b=uoJbA3YA7T5wZVU9rdlOq7N2bevkc+jWh3+nw9DWBPww/AFFeakZYadRSl1L1RNfjBtLkd vKKuSUmdq9Qj8MZBkOMldz3UAWC+t4xvY1Ig20UPDAfT1H/s3LFWy5i/FuvtBbMMN/JhEa YMhmbxO60D+nBup/PHS6wwyR+FaT/ok= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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 szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R5WTz42kTz18LrV; Wed, 19 Jul 2023 17:58:15 +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:58 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 7/9] mm/page_io: use a folio in swap_writepage_bdev_async() Date: Wed, 19 Jul 2023 17:58:46 +0800 Message-ID: <20230719095848.3422629-8-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: 3B3E540015 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 3zciibjs169wcd77jde36hg6bjcmw7x1 X-HE-Tag: 1689760743-434547 X-HE-Meta: U2FsdGVkX19Mm3fjOFUGxP8PtNdAYnI/ZJx8ZE9lbZhDxt+2OhPlgN6NDvcpCNGbmXcnvb9VyvsqahZbpvH7gYA/nVXARtD2jw0Bb5LpF5ekiqcBitYtpdk+NNqB0kp+SE7n6bHG/Zm+m5ERu6Ox4fxoRpTxe1ffxq/02aG41ZdJzKJOtlMxYAT1nvRY9IMILArI5JzM8VmxuVROpkYhFbUK8QSJPm7QDthNNQsmTOk3vjs6FcRq0AVRPtm9ognBO2ppgh5ZGB2BedxJJ6YetmNI5O5AkmjeM5V1gdyhVV9YSiKFbS9D2ovcx1uwSs0NPkdxT2ptdiCJtREveFlZ7F4bwI1CBsIpauckxGUBfO7HzRcKlKi1Cn/F1Blf0Yd1DtODp58HU3vlsxmpoAzbqmmNygIeUg5XtXEFiYoaZerXRYHxpSwmk0qcayGzi0CEQ+cewjSWQDEE2jLsc+UHlmXAao2U03Drsng9i8u8Clr/LHQAWqdXAkDI6h02j3aBts0zeL5yro6jAbLmFaQOCzmoW7jwbDp5bqW6b5YGBerlGHXpOi7eWmri0RXN3LeD/cBoYQrTMzACPBz6smDgW8LhSnzK5O/ZnTHBSwczMdR8tkZUjc3VyNThKKaoh6fIgu1xX2C92wA185AGF4MA0DoE8IRF12ZkOZqeieiEwP3TI1jhfjbowM5d95R8B7p/nCTznoN0O3hM9lhtZbD6oN9gLDiNvgq2UuY9A+tc5MjM13sJA+NrhcsVXiqd3uOy/E8qFpoaaMxjzJL1g0+F3AP8hUN7Lk6BVQ1bP99I/3JwdqOryuXqG/SWt/3FmJNhuVz7b4dXGpT9YLmECgrMFy2qnlzqWVSSWRCS4BaGTxcdlb7CsuKXGjqOFOyMVF0YMOmqobDrSjKzWOX9ARl0YI/du6YklKtwjlXWFgv3MDv0osAtAZX5T8NazL1jRzBGCFfsiTkskiKnqrN/Ddv FjujluET wtoxSeFrW61wch5gRGlZXUfaQmwIlDw1VBMtvQ52YoYEVJAm5LQJrz7Uj09Urh2iDgM8P6wg+Hv8THBDTZEE2+WlUMo/Cx2Yd5VfOBn8PUOkGseFdSt7LjNoRCiOqNAOunFd+HIhQfi1s8HGdppt4oJj6vpi7E3w4lxVljiXFHPi+Q2USrzuEiSrCuFVfQiaawgu5v6Pknxs9fcZ3aDOYVDUFhHos3Tv1DmmGENJKcmS4CVqfnyoRUp+uEQ== 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 0c96ea9dd258..e28395331bb0 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); }