Re: [PATCH 11/24] xfs:: account for memory freed from metadata buffers

Christoph Hellwig
2019-08-01T08:16:04Z

> +
> + /*
> + * Account for the buffer memory freed here so memory reclaim
> + * sees this and not just the xfs_buf slab entry being freed.
> + */
> + if (current->reclaim_state)
> + current->reclaim_state->reclaimed_pages += bp->b_page_count;
> +

I think this wants a mm-layer helper ala:

static inline void shrinker_mark_pages_reclaimed(unsigned long nr_pages)
{
if (current->reclaim_state)
current->reclaim_state->reclaimed_pages += nr_pages;
}

plus good documentation on when to use it.