Message ID | 20240322083703.232364-14-alexs@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | transfer page to folio in KSM | expand |
On Fri, Mar 22, 2024 at 04:37:00PM +0800, alexs@kernel.org wrote: > From: "Alex Shi (tencent)" <alexs@kernel.org> > > Only single page could be reached where we set stable node after write > protect, so use folio converted func to replace page's. > > Signed-off-by: Alex Shi (tencent) <alexs@kernel.org> > Cc: Izik Eidus <izik.eidus@ravellosystems.com> > Cc: Matthew Wilcox <willy@infradead.org> > Cc: Andrea Arcangeli <aarcange@redhat.com> > Cc: Hugh Dickins <hughd@google.com> > Cc: Chris Wright <chrisw@sous-sol.org> > --- > mm/ksm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/ksm.c b/mm/ksm.c > index 15a78a9bab59..d7c4cc4a0cc1 100644 > --- a/mm/ksm.c > +++ b/mm/ksm.c > @@ -1518,7 +1518,7 @@ static int try_to_merge_one_page(struct vm_area_struct *vma, > * PageAnon+anon_vma to PageKsm+NULL stable_node: > * stable_tree_insert() will update stable_node. > */ > - set_page_stable_node(page, NULL); > + folio_set_stable_node(page_folio(page), NULL); > mark_page_accessed(page); I'd rather you did a conversion of try_to_merge_one_page() instead of just this. It'll be a fun one because you'll have to recalculate the folio after calling split_huge_page().
On 3/23/24 11:38 AM, Matthew Wilcox wrote: > On Fri, Mar 22, 2024 at 04:37:00PM +0800, alexs@kernel.org wrote: >> From: "Alex Shi (tencent)" <alexs@kernel.org> >> >> Only single page could be reached where we set stable node after write >> protect, so use folio converted func to replace page's. >> >> Signed-off-by: Alex Shi (tencent) <alexs@kernel.org> >> Cc: Izik Eidus <izik.eidus@ravellosystems.com> >> Cc: Matthew Wilcox <willy@infradead.org> >> Cc: Andrea Arcangeli <aarcange@redhat.com> >> Cc: Hugh Dickins <hughd@google.com> >> Cc: Chris Wright <chrisw@sous-sol.org> >> --- >> mm/ksm.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/ksm.c b/mm/ksm.c >> index 15a78a9bab59..d7c4cc4a0cc1 100644 >> --- a/mm/ksm.c >> +++ b/mm/ksm.c >> @@ -1518,7 +1518,7 @@ static int try_to_merge_one_page(struct vm_area_struct *vma, >> * PageAnon+anon_vma to PageKsm+NULL stable_node: >> * stable_tree_insert() will update stable_node. >> */ >> - set_page_stable_node(page, NULL); >> + folio_set_stable_node(page_folio(page), NULL); >> mark_page_accessed(page); > > I'd rather you did a conversion of try_to_merge_one_page() instead of > just this. It'll be a fun one because you'll have to recalculate the > folio after calling split_huge_page(). Hi Willy, Definitely right, the merge series funcs need more careful changes. :) I'd like to left them for late changes. Thanks
diff --git a/mm/ksm.c b/mm/ksm.c index 15a78a9bab59..d7c4cc4a0cc1 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1518,7 +1518,7 @@ static int try_to_merge_one_page(struct vm_area_struct *vma, * PageAnon+anon_vma to PageKsm+NULL stable_node: * stable_tree_insert() will update stable_node. */ - set_page_stable_node(page, NULL); + folio_set_stable_node(page_folio(page), NULL); mark_page_accessed(page); /* * Page reclaim just frees a clean page with no dirty