Re: [PATCH 02/24] shrinkers: use will_defer for GFP_NOFS sensitive shrinkers

Dave Chinner
2019-08-04T01:51:39Z

On Fri, Aug 02, 2019 at 11:27:37AM -0400, Brian Foster wrote:
> On Thu, Aug 01, 2019 at 12:17:30PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > For shrinkers that currently avoid scanning when called under
> > GFP_NOFS contexts, conver them to use the new ->will_defer flag
> > rather than checking and returning errors during scans.
> >
> > This makes it very clear that these shrinkers are not doing any work
> > because of the context limitations, not because there is no work
> > that can be done.
> >
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
> > drivers/staging/android/ashmem.c | 8 ++++----
> > fs/gfs2/glock.c | 5 +++--
> > fs/gfs2/quota.c | 6 +++---
> > fs/nfs/dir.c | 6 +++---
> > fs/super.c | 6 +++---
> > fs/xfs/xfs_buf.c | 4 ++++
> > fs/xfs/xfs_qm.c | 11 ++++++++---
> > net/sunrpc/auth.c | 5 ++---
> > 8 files changed, 30 insertions(+), 21 deletions(-)
> >
> ...
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index ca0849043f54..6e0f76532535 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -1680,6 +1680,10 @@ xfs_buftarg_shrink_count(
> > {
> > struct xfs_buftarg *btp = container_of(shrink,
> > struct xfs_buftarg, bt_shrinker);
> > +
> > + if (!(sc->gfp_mask & __GFP_FS))
> > + sc->will_defer = true;
> > +
> > return list_lru_shrink_count(&btp->bt_lru, sc);
> > }
>
> This hunk looks like a behavior change / bug fix..? The rest of the

Yeah, forgot to move that to the patch that fixes the accounting for
the xfs_buf cache later on in the series. Will fix.

-Dave.
--
Dave Chinner
david@fromorbit.com