From patchwork Fri Jun 30 12:13:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13298109 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 C7D23EB64DA for ; Fri, 30 Jun 2023 12:13:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E7C98E0010; Fri, 30 Jun 2023 08:13:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3621D8E000F; Fri, 30 Jun 2023 08:13:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 202478D0011; Fri, 30 Jun 2023 08:13:31 -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 0BB9C8D0001 for ; Fri, 30 Jun 2023 08:13:31 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CD6C6C0A1C for ; Fri, 30 Jun 2023 12:13:30 +0000 (UTC) X-FDA: 80959304580.21.EE2BE19 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf07.hostedemail.com (Postfix) with ESMTP id D126C40023 for ; Fri, 30 Jun 2023 12:13:25 +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=1688127208; 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=v4G7xZ1P7BBK5tKU1+W2DUw6GoPY63Bhg9it6ICKAhw=; b=xDe0F8sQXPtOj9WKfbSfxwb+1NkmI3GMyPqfBmKkUlMMICDByh6M3bPLqAnOlf6V6i5fXE GTkzJxd6vxvrqQuHz8OiMP65hbnqYeiRGpFsIOIt0CTYC4KYJufA+ceNZi6y56rmBpigHU /Mzulef907bmjSGNBhPrRTASsdy9230= 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=1688127208; a=rsa-sha256; cv=none; b=UOe5+Unniz0+7Fy9XV4DVx0joyEDqhY/c1seruyseoO0+POW8VJ5nPF5yK2OEvFE1jYOdV RRBStSy/eS+C1Swdz1dyq2TWbPiXrkhoumCtcSziPH4G8ALZypOwngsLqsplLpmJjbyvvw OMaRO3ufWzmPtrdJZqmaM2ur5ZRCJuc= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QsvMb2rGwzTlft; Fri, 30 Jun 2023 20:12:27 +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; Fri, 30 Jun 2023 20:13:21 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 2/2] mm: use a folio in fault_dirty_shared_page() Date: Fri, 30 Jun 2023 20:13:10 +0800 Message-ID: <20230630121310.165700-3-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230630121310.165700-1-zhangpeng362@huawei.com> References: <20230630121310.165700-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-Server: rspam09 X-Rspamd-Queue-Id: D126C40023 X-Stat-Signature: g8776fpufnspen43r7qwkq6g7yutt4cc X-Rspam-User: X-HE-Tag: 1688127205-17817 X-HE-Meta: U2FsdGVkX19MONGL109KMIjJTkCtgUpgu5tfXwkIj6lfjWHfMUiBu9sBiy/6IbQMB3ARAJl5HxpQMi3fHQ7/n8X6+OEgvdfHMVdSbCRdrIepyEZm3tSjp1lB8aRz2auGw50pO+oQHXyUZrpVw5xU5p890o6n1iXkM+8jQgD1mHdJA1AFWtedJtYMWUdpokOn/0t3x/VZeOMbalYBDB2zNmwot4Klj9K5n+RZotlvoWXOiyaHdzZe/urkwNVOrty2fTv+lTAy4E8D0mIg+kQiM6awdsfLp9zOBzGSe9nJM8gOerGsWq1pZqaatGgAkhLw324RveeDYGU7RPHYsQleNaPm1S34HiYRT2us3jxrgwodX2T/5napQz8j08vycugP20/DMbmp2wnuHxHrUZhGI/3BpmaGY3ZHBsO5QEPRjJr9OyBwofE3fbQGZcWtLGdL5a/Rqfcim2eK2QrlCkVOvSWQdWt4L+iks1zeZVVEWue0fB/KTy7AHpdgq6oAWWLJkoGEfaGVtccNNPYPaII1CJWt7gRHldo1klj4KkW2/o+B/hluH4xiQKIAyoRU7krOY3aTYeEBHMUc91F1tJojCFp4RO7P+W+j/Ra79HNFDIcNiP99WkFIw6YOqOFqf4sn0rp9Jle3ryDDmZW9eegkNhu43EIVGbqYUJ298OXtwhoRqh1v661uSj95JUlMzMZsBmIb06jIgbJJVHXTg+jCepEuQ/LH5o2joJpkVdBAbxjV4GtDUx1VB5PkJ0k/S4g7MTnSGy86VmHeJw3gudhHCxcGnrG2AZJcxBnrHvlqcF+6F3aEBwPuFX/V08JOvkaDt+wOL2JovVdF99e7+Du1Qx79N6RyfXRv0hSP6PRw9xiZSBleZaRmNn3urHiZGOtdB/CCRgwgBYqOhUfHt+ixWXOQW1xjAkUe4cEP3GEcph+BO6SXchP7UQ4OHA+rSGWXA8YWEZ1Pa6fGXTkRkHa 2Shp0Svu lfDBN9kZyte/2MdSjggCtixFDKuVKzQnlWLep3Pgas1Bqov5V6F6QArG3/G+iekFcN+N3QMV42vF/qcRYmLYYbOUKK1ZklYoY35KKUh/niGsMoVZK1hUjl3rd/k0RSR0DmYN9gCpcx7ZDwbQfJGnpbvC9WcAunU/A30RXFwFoVxzfB0Z+ld6PC5veFeTkGQVmqban 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 We can replace four implicit calls to compound_head() with one by using folio. Signed-off-by: ZhangPeng Reviewed-by: Sidhartha Kumar --- mm/memory.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 6921df44a99f..73b03706451c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2967,20 +2967,20 @@ static vm_fault_t fault_dirty_shared_page(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct address_space *mapping; - struct page *page = vmf->page; + struct folio *folio = page_folio(vmf->page); bool dirtied; bool page_mkwrite = vma->vm_ops && vma->vm_ops->page_mkwrite; - dirtied = set_page_dirty(page); - VM_BUG_ON_PAGE(PageAnon(page), page); + dirtied = folio_mark_dirty(folio); + VM_BUG_ON_FOLIO(folio_test_anon(folio), folio); /* * Take a local copy of the address_space - page.mapping may be zeroed * by truncate after unlock_page(). The address_space itself remains * pinned by vma->vm_file's reference. We rely on unlock_page()'s * release semantics to prevent the compiler from undoing this copying. */ - mapping = folio_raw_mapping(page_folio(page)); - unlock_page(page); + mapping = folio_raw_mapping(folio); + folio_unlock(folio); if (!page_mkwrite) file_update_time(vma->vm_file);