Re: [External] Re: [PATCH v4 3/7] mm: memcontrol: convert NR_FILE_THPS account to pages

From: Muchun Song
Date: Fri Dec 11 2020 - 09:16:41 EST


On Fri, Dec 11, 2020 at 9:57 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Fri, Dec 11, 2020 at 12:19:50PM +0800, Muchun Song wrote:
> > +++ b/mm/filemap.c
> > @@ -207,7 +207,7 @@ static void unaccount_page_cache_page(struct address_space *mapping,
> > if (PageTransHuge(page))
> > __dec_lruvec_page_state(page, NR_SHMEM_THPS);
> > } else if (PageTransHuge(page)) {
> > - __dec_lruvec_page_state(page, NR_FILE_THPS);
> > + __mod_lruvec_page_state(page, NR_FILE_THPS, -HPAGE_PMD_NR);
>
> + __mod_lruvec_page_state(page, NR_FILE_THPS, -nr);

Thank you.

>
> > +++ b/mm/huge_memory.c
> > @@ -2748,7 +2748,8 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
> > if (PageSwapBacked(head))
> > __dec_lruvec_page_state(head, NR_SHMEM_THPS);
> > else
> > - __dec_lruvec_page_state(head, NR_FILE_THPS);
> > + __mod_lruvec_page_state(head, NR_FILE_THPS,
> > + -HPAGE_PMD_NR);
>
> + __mod_lruvec_page_state(head, NR_FILE_THPS,
> + -thp_nr_pages(head));
>

Thanks.

--
Yours,
Muchun