All of lore.kernel.org
 help / color / mirror / Atom feed
From: Knut Petersen <Knut_Petersen@t-online.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Linux MM <linux-mm@kvack.org>, Rik van Riel <riel@redhat.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	LKML <linux-kernel@vger.kernel.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Michal Hocko <mhocko@suse.cz>, Mel Gorman <mgorman@suse.de>,
	Glauber Costa <glommer@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [Intel-gfx] [PATCH] [RFC] mm/shrinker: Add a shrinker flag to always shrink a bit
Date: Wed, 18 Sep 2013 12:38:23 +0200	[thread overview]
Message-ID: <5239829F.4080601@t-online.de> (raw)
In-Reply-To: <1379495401-18279-1-git-send-email-daniel.vetter@ffwll.ch>

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On 18.09.2013 11:10, Daniel Vetter wrote:

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.

Well, you should. Since commit 81e49f  shrinker->count_objects might be
set to SHRINK_STOP, causing shrink_slab_node() to complain loud and often:

[ 1908.234595] shrink_slab: i915_gem_inactive_scan+0x0/0x9c negative objects to delete nr=-xxxxxxxxx

The kernel emitted a few thousand log lines like the one quoted above during the
last few days on my system.

> 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 = max_pass;
>   		}
>   
> +		/* Always try to shrink a bit to make forward progress. */
> +		if (shrinker->evicts_to_page_lru)
> +			total_scan = 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

Have a look at the attached patch. It fixes my problem with the erroneous/misleading
error messages, and I think it´s right to just bail out early if SHRINK_STOP is found.

Do you agree ?

cu,
  Knut


[-- Attachment #2: 0001-mm-respect-SHRINK_STOP-in-shrink_slab_node.patch --]
[-- Type: text/x-patch, Size: 1128 bytes --]

>From 75ae570ce7b0bb6b40c76beb18fc075e9af3127a Mon Sep 17 00:00:00 2001
From: Knut Petersen <Knut_Petersen@t-online.de>
Date: Wed, 18 Sep 2013 12:06:33 +0200
Subject: [PATCH] mm: respect SHRINK_STOP in shrink_slab_node()

Since commit 81e49f811404f428a9d9a63295a0c267e802fa12
i915_gem_inactive_count() might return SHRINK_STOP.

Unfortunately SHRINK_STOP is not handled propperly in
shrink_slab_node(), causing a system log cluttered with
kernel error messages complaining about "negative objects
to delete".

I think the proper way of handling SHRINK_STOP is obvious,
we should obey ;-)

Signed-off-by: Knut Petersen <Knut_Petersen@t-online.de>
---
 mm/vmscan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 8ed1b77..b1e6f0d 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -244,6 +244,8 @@ shrink_slab_node(struct shrink_control *shrinkctl, struct shrinker *shrinker,
 	max_pass = shrinker->count_objects(shrinker, shrinkctl);
 	if (max_pass == 0)
 		return 0;
+	if (max_pass == SHRINK_STOP)
+		return 0;
 
 	/*
 	 * copy the current shrinker scan count into a local variable
-- 
1.8.1.4


WARNING: multiple messages have this Message-ID (diff)
From: Knut Petersen <Knut_Petersen@t-online.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Linux MM <linux-mm@kvack.org>, Rik van Riel <riel@redhat.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	LKML <linux-kernel@vger.kernel.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Michal Hocko <mhocko@suse.cz>, Mel Gorman <mgorman@suse.de>,
	Glauber Costa <glommer@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [Intel-gfx] [PATCH] [RFC] mm/shrinker: Add a shrinker flag to always shrink a bit
Date: Wed, 18 Sep 2013 12:38:23 +0200	[thread overview]
Message-ID: <5239829F.4080601@t-online.de> (raw)
In-Reply-To: <1379495401-18279-1-git-send-email-daniel.vetter@ffwll.ch>

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On 18.09.2013 11:10, Daniel Vetter wrote:

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.

Well, you should. Since commit 81e49f  shrinker->count_objects might be
set to SHRINK_STOP, causing shrink_slab_node() to complain loud and often:

[ 1908.234595] shrink_slab: i915_gem_inactive_scan+0x0/0x9c negative objects to delete nr=-xxxxxxxxx

The kernel emitted a few thousand log lines like the one quoted above during the
last few days on my system.

> 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 = max_pass;
>   		}
>   
> +		/* Always try to shrink a bit to make forward progress. */
> +		if (shrinker->evicts_to_page_lru)
> +			total_scan = 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

Have a look at the attached patch. It fixes my problem with the erroneous/misleading
error messages, and I think it's right to just bail out early if SHRINK_STOP is found.

Do you agree ?

cu,
  Knut


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mm-respect-SHRINK_STOP-in-shrink_slab_node.patch --]
[-- Type: text/x-patch; name="0001-mm-respect-SHRINK_STOP-in-shrink_slab_node.patch", Size: 0 bytes --]



  reply	other threads:[~2013-09-18 10:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-18  9:10 [PATCH] [RFC] mm/shrinker: Add a shrinker flag to always shrink a bit Daniel Vetter
2013-09-18  9:10 ` Daniel Vetter
2013-09-18 10:38 ` Knut Petersen [this message]
2013-09-18 10:38   ` [Intel-gfx] " Knut Petersen
2013-09-18 10:56   ` Daniel Vetter
2013-09-18 10:56     ` Daniel Vetter
2013-09-18 10:56     ` Daniel Vetter
2013-09-18 11:34     ` Knut Petersen
2013-09-18 11:34       ` Knut Petersen
2013-09-18 11:34       ` Knut Petersen
2013-09-18 20:38   ` Dave Chinner
2013-09-18 20:38     ` Dave Chinner
2013-09-18 20:38     ` Dave Chinner
2013-09-18 23:52     ` Dave Chinner
2013-09-18 23:52       ` Dave Chinner
2013-09-18 23:52       ` Dave Chinner
2013-09-19  6:57     ` Daniel Vetter
2013-09-19  6:57       ` Daniel Vetter
2013-09-19  7:32       ` Dave Chinner
2013-09-19  7:32         ` Dave Chinner
2013-09-19  8:04       ` Knut Petersen
2013-09-19  8:04         ` Knut Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5239829F.4080601@t-online.de \
    --to=knut_petersen@t-online.de \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=glommer@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=riel@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.