* [PATCH v2 0/2] mm: remove page_rmapping()
@ 2023-07-01 3:28 Peng Zhang
2023-07-01 3:28 ` [PATCH v2 1/2] mm: use a folio in fault_dirty_shared_page() Peng Zhang
2023-07-01 3:28 ` [PATCH v2 2/2] mm: remove page_rmapping() Peng Zhang
0 siblings, 2 replies; 5+ messages in thread
From: Peng Zhang @ 2023-07-01 3:28 UTC (permalink / raw)
To: linux-mm, linux-kernel, willy, sidhartha.kumar
Cc: akpm, wangkefeng.wang, sunnanyong, ZhangPeng
From: ZhangPeng <zhangpeng362@huawei.com>
This minor patch series convert fault_dirty_shared_page() to use a folio
first, then remove the now-unused page_rmapping().
Change log:
v2:
- reverse the order of the two patches
- add RBs from Sidhartha Kumar
- update comment
ZhangPeng (2):
mm: use a folio in fault_dirty_shared_page()
mm: remove page_rmapping()
include/linux/mm.h | 1 -
mm/memory.c | 16 ++++++++--------
mm/util.c | 6 ------
3 files changed, 8 insertions(+), 15 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] mm: use a folio in fault_dirty_shared_page()
2023-07-01 3:28 [PATCH v2 0/2] mm: remove page_rmapping() Peng Zhang
@ 2023-07-01 3:28 ` Peng Zhang
2023-07-02 0:01 ` Matthew Wilcox
2023-07-01 3:28 ` [PATCH v2 2/2] mm: remove page_rmapping() Peng Zhang
1 sibling, 1 reply; 5+ messages in thread
From: Peng Zhang @ 2023-07-01 3:28 UTC (permalink / raw)
To: linux-mm, linux-kernel, willy, sidhartha.kumar
Cc: akpm, wangkefeng.wang, sunnanyong, ZhangPeng
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>
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
mm/memory.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index 765e5d8ed1f4..9a2f4dab872f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2968,20 +2968,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
+ * Take a local copy of the address_space - folio.mapping may be zeroed
+ * by truncate after folio_unlock(). The address_space itself remains
+ * pinned by vma->vm_file's reference. We rely on folio_unlock()'s
* release semantics to prevent the compiler from undoing this copying.
*/
- mapping = page_rmapping(page);
- unlock_page(page);
+ mapping = folio_raw_mapping(folio);
+ folio_unlock(folio);
if (!page_mkwrite)
file_update_time(vma->vm_file);
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] mm: remove page_rmapping()
2023-07-01 3:28 [PATCH v2 0/2] mm: remove page_rmapping() Peng Zhang
2023-07-01 3:28 ` [PATCH v2 1/2] mm: use a folio in fault_dirty_shared_page() Peng Zhang
@ 2023-07-01 3:28 ` Peng Zhang
2023-07-02 0:02 ` Matthew Wilcox
1 sibling, 1 reply; 5+ messages in thread
From: Peng Zhang @ 2023-07-01 3:28 UTC (permalink / raw)
To: linux-mm, linux-kernel, willy, sidhartha.kumar
Cc: akpm, wangkefeng.wang, sunnanyong, ZhangPeng
From: ZhangPeng <zhangpeng362@huawei.com>
After converting the last user to folio_raw_mapping(), we can safely
remove the function.
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
include/linux/mm.h | 1 -
mm/util.c | 6 ------
2 files changed, 7 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 39aa409e84d5..c849419c6b51 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2151,7 +2151,6 @@ static inline void *folio_address(const struct folio *folio)
return page_address(&folio->page);
}
-extern void *page_rmapping(struct page *page);
extern pgoff_t __page_file_index(struct page *page);
/*
diff --git a/mm/util.c b/mm/util.c
index dd12b9531ac4..5e9305189c3f 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -734,12 +734,6 @@ void *vcalloc(size_t n, size_t size)
}
EXPORT_SYMBOL(vcalloc);
-/* Neutral page->mapping pointer to address_space or anon_vma or other */
-void *page_rmapping(struct page *page)
-{
- return folio_raw_mapping(page_folio(page));
-}
-
struct anon_vma *folio_anon_vma(struct folio *folio)
{
unsigned long mapping = (unsigned long)folio->mapping;
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] mm: use a folio in fault_dirty_shared_page()
2023-07-01 3:28 ` [PATCH v2 1/2] mm: use a folio in fault_dirty_shared_page() Peng Zhang
@ 2023-07-02 0:01 ` Matthew Wilcox
0 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2023-07-02 0:01 UTC (permalink / raw)
To: Peng Zhang
Cc: linux-mm, linux-kernel, sidhartha.kumar, akpm, wangkefeng.wang,
sunnanyong
On Sat, Jul 01, 2023 at 11:28:52AM +0800, Peng Zhang wrote:
> 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>
> Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] mm: remove page_rmapping()
2023-07-01 3:28 ` [PATCH v2 2/2] mm: remove page_rmapping() Peng Zhang
@ 2023-07-02 0:02 ` Matthew Wilcox
0 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2023-07-02 0:02 UTC (permalink / raw)
To: Peng Zhang
Cc: linux-mm, linux-kernel, sidhartha.kumar, akpm, wangkefeng.wang,
sunnanyong
On Sat, Jul 01, 2023 at 11:28:53AM +0800, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@huawei.com>
>
> After converting the last user to folio_raw_mapping(), we can safely
> remove the function.
>
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
> Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Thank you!
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-02 0:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-01 3:28 [PATCH v2 0/2] mm: remove page_rmapping() Peng Zhang
2023-07-01 3:28 ` [PATCH v2 1/2] mm: use a folio in fault_dirty_shared_page() Peng Zhang
2023-07-02 0:01 ` Matthew Wilcox
2023-07-01 3:28 ` [PATCH v2 2/2] mm: remove page_rmapping() Peng Zhang
2023-07-02 0:02 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox