Re: [RFC PATCH v1 1/2] mm: vmscan: refactor updating reclaimed pages in reclaim_state

From: Yosry Ahmed
Date: Fri Feb 03 2023 - 17:31:26 EST


On Fri, Feb 3, 2023 at 8:22 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Thu, Feb 02, 2023 at 11:32:28PM +0000, Yosry Ahmed wrote:
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index 54c774af6e1c..060079f1e966 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -286,8 +286,7 @@ xfs_buf_free_pages(
> > if (bp->b_pages[i])
> > __free_page(bp->b_pages[i]);
> > }
> > - if (current->reclaim_state)
> > - current->reclaim_state->reclaimed_slab += bp->b_page_count;
> > + report_freed_pages(bp->b_page_count);
>
> XFS can be built as a module

I didn't know that, thanks for pointing it out!

>
> > +++ b/mm/vmscan.c
> > @@ -204,6 +204,19 @@ static void set_task_reclaim_state(struct task_struct *task,
> > task->reclaim_state = rs;
> > }
> >
> > +/*
> > + * reclaim_report_freed_pages: report pages freed outside of LRU-based reclaim
> > + * @pages: number of pages freed
> > + *
> > + * If the current process is undergoing a reclaim operation,
> > + * increment the number of reclaimed pages by @pages.
> > + */
> > +void report_freed_pages(unsigned long pages)
> > +{
> > + if (current->reclaim_state)
> > + current->reclaim_state->reclaimed += pages;
> > +}
> > +
>
> report_free_pages is not EXPORT_SYMBOLed

Will do that for the next version, thanks!