linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peng Zhang <zhangpeng362@huawei.com>
To: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Cc: <willy@infradead.org>, <sidhartha.kumar@oracle.com>,
	<akpm@linux-foundation.org>, <wangkefeng.wang@huawei.com>,
	<sunnanyong@huawei.com>, ZhangPeng <zhangpeng362@huawei.com>
Subject: [PATCH 2/2] mm: use a folio in fault_dirty_shared_page()
Date: Fri, 30 Jun 2023 20:13:10 +0800	[thread overview]
Message-ID: <20230630121310.165700-3-zhangpeng362@huawei.com> (raw)
In-Reply-To: <20230630121310.165700-1-zhangpeng362@huawei.com>

From: ZhangPeng <zhangpeng362@huawei.com>

We can replace four implicit calls to compound_head() with one by using
folio.

Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
 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);
-- 
2.25.1



  parent reply	other threads:[~2023-06-30 12:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 12:13 [PATCH 0/2] mm: remove page_rmapping() Peng Zhang
2023-06-30 12:13 ` [PATCH 1/2] " Peng Zhang
2023-06-30 15:56   ` Sidhartha Kumar
2023-06-30 16:03   ` Sidhartha Kumar
2023-07-01  2:57     ` zhangpeng (AS)
2023-06-30 12:13 ` Peng Zhang [this message]
2023-06-30 15:58   ` [PATCH 2/2] mm: use a folio in fault_dirty_shared_page() Sidhartha Kumar
2023-06-30 21:39 ` [PATCH 0/2] mm: remove page_rmapping() Matthew Wilcox
2023-07-01  2:57   ` zhangpeng (AS)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230630121310.165700-3-zhangpeng362@huawei.com \
    --to=zhangpeng362@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sidhartha.kumar@oracle.com \
    --cc=sunnanyong@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox