Re: [PATCH v7] mm, drm/i915: mark pinned shmemfs pages as unevictable

From: Chris Wilson
Date: Wed Nov 07 2018 - 10:35:57 EST


Quoting Andrew Morton (2018-11-06 18:12:11)
> On Tue, 6 Nov 2018 13:23:24 +0000 Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
>
> > From: Kuo-Hsin Yang <vovoy@xxxxxxxxxxxx>
> >
> > The i915 driver uses shmemfs to allocate backing storage for gem
> > objects. These shmemfs pages can be pinned (increased ref count) by
> > shmem_read_mapping_page_gfp(). When a lot of pages are pinned, vmscan
> > wastes a lot of time scanning these pinned pages. In some extreme case,
> > all pages in the inactive anon lru are pinned, and only the inactive
> > anon lru is scanned due to inactive_ratio, the system cannot swap and
> > invokes the oom-killer. Mark these pinned pages as unevictable to speed
> > up vmscan.
> >
> > Export pagevec API check_move_unevictable_pages().
> >
> > This patch was inspired by Chris Wilson's change [1].
> >
> > [1]: https://patchwork.kernel.org/patch/9768741/
> >
> > ...
> >
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -2382,12 +2382,26 @@ void __i915_gem_object_invalidate(struct drm_i915_gem_object *obj)
> > invalidate_mapping_pages(mapping, 0, (loff_t)-1);
> > }
> >
> > +/**
>
> This token is used to introduce a kerneldoc comment.
>
> > + * Move pages to appropriate lru and release the pagevec. Decrement the ref
> > + * count of these pages.
> > + */
>
> But this isn't a kerneldoc comment.
>
> At least, I don't think it is. Maybe the parser got smarter when I
> wasn't looking.
>
> > +static inline void check_release_pagevec(struct pagevec *pvec)
> > +{
> > + if (pagevec_count(pvec)) {
> > + check_move_unevictable_pages(pvec);
> > + __pagevec_release(pvec);
> > + cond_resched();
> > + }
> > +}
>
> This looks too large to be inlined and the compiler will ignore the
> `inline' anyway.

Applied both corrections.

> Otherwise, Acked-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>. Please
> go ahead and merge via the appropriate drm tree.

Thank you, pushed to drm-intel, expected to arrive around 4.21.
-Chris