From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: [Intel-gfx] [PATCH] [RFC] mm/shrinker: Add a shrinker flag to always shrink a bit Date: Thu, 19 Sep 2013 06:38:22 +1000 Message-ID: <20130918203822.GA4330@dastard> References: <1379495401-18279-1-git-send-email-daniel.vetter@ffwll.ch> <5239829F.4080601@t-online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <5239829F.4080601@t-online.de> Sender: owner-linux-mm@kvack.org To: Knut Petersen Cc: Daniel Vetter , Linux MM , Rik van Riel , Intel Graphics Development , Johannes Weiner , LKML , DRI Development , Michal Hocko , Mel Gorman , Glauber Costa , Andrew Morton , Linus Torvalds List-Id: intel-gfx@lists.freedesktop.org On Wed, Sep 18, 2013 at 12:38:23PM +0200, Knut Petersen wrote: > On 18.09.2013 11:10, Daniel Vetter wrote: >=20 > Just now I prepared a patch changing the same function in vmscan.c > >Also, this needs to be rebased to the new shrinker api in 3.12, I > >simply haven't rolled my trees forward yet. >=20 > Well, you should. Since commit 81e49f shrinker->count_objects might be > set to SHRINK_STOP, causing shrink_slab_node() to complain loud and oft= en: >=20 > [ 1908.234595] shrink_slab: i915_gem_inactive_scan+0x0/0x9c negative ob= jects to delete nr=3D-xxxxxxxxx >=20 > The kernel emitted a few thousand log lines like the one quoted above d= uring the > last few days on my system. >=20 > >diff --git a/mm/vmscan.c b/mm/vmscan.c > >index 2cff0d4..d81f6e0 100644 > >--- a/mm/vmscan.c > >+++ b/mm/vmscan.c > >@@ -254,6 +254,10 @@ unsigned long shrink_slab(struct shrink_control *= shrink, > > total_scan =3D max_pass; > > } > >+ /* Always try to shrink a bit to make forward progress. */ > >+ if (shrinker->evicts_to_page_lru) > >+ total_scan =3D max_t(long, total_scan, batch_size); > >+ > At that place the error message is already emitted. > > /* > > * We need to avoid excessive windup on filesystem shrinkers > > * due to large numbers of GFP_NOFS allocations causing the >=20 > Have a look at the attached patch. It fixes my problem with the erroneo= us/misleading > error messages, and I think it=B4s right to just bail out early if SHRI= NK_STOP is found. >=20 > Do you agree ? No, that's wrong. ->count_objects should never ass SHRINK_STOP. Indeed, it should always return a count of objects in the cache, regardless of the context.=20 SHRINK_STOP is for ->scan_objects to tell the shrinker it can make any progress due to the context it is called in. This allows the shirnker to defer the work to another call in a different context. However, if ->count-objects doesn't return a count, the work that was supposed to be done cannot be deferred, and that is what ->count_objects should always return the number of objects in the cache. Cheers, Dave. --=20 Dave Chinner david@fromorbit.com -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org