From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266AbdK0CjP (ORCPT ); Sun, 26 Nov 2017 21:39:15 -0500 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:54019 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751024AbdK0CjO (ORCPT ); Sun, 26 Nov 2017 21:39:14 -0500 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.220.163 X-Original-MAILFROM: minchan@kernel.org Date: Mon, 27 Nov 2017 11:39:12 +0900 From: Minchan Kim To: Jiang Biao Cc: akpm@linux-foundation.org, mhocko@suse.com, hannes@cmpxchg.org, hillf.zj@alibaba-inc.com, ying.huang@intel.com, mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn Subject: Re: [PATCH] mm/vmscan: make do_shrink_slab more robust. Message-ID: <20171127023912.GB27255@bbox> References: <1511746650-51945-1-git-send-email-jiang.biao2@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1511746650-51945-1-git-send-email-jiang.biao2@zte.com.cn> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, Nov 27, 2017 at 09:37:30AM +0800, Jiang Biao wrote: > When running ltp stress test for 7*24 hours, the kernel occasionally > complains the following warning continuously, > > mb_cache_shrink_scan+0x0/0x3f0 negative objects to delete > nr=-9222526086287711848 > mb_cache_shrink_scan+0x0/0x3f0 negative objects to delete > nr=-9222420761333860545 > mb_cache_shrink_scan+0x0/0x3f0 negative objects to delete > nr=-9222287677544280360 > ... > > The tracing result shows the freeable(mb_cache_shrink_scan returns) > is -1, which causes the continuous accumulation and overflow of > total_scan. Good catch. > > This patch make do_shrink_slab more robust when > shrinker->count_objects return negative freeable. Shrinker.h says count_objects should return 0 if there are no freeable objects, not -1. So if something returns -1, changing it with returning 0 would be more proper fix. Thanks. > > Signed-off-by: Jiang Biao > --- > mm/vmscan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index eb2f031..3ea28f0 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -323,7 +323,7 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, > long scanned = 0, next_deferred; > > freeable = shrinker->count_objects(shrinker, shrinkctl); > - if (freeable == 0) > + if (freeable <= 0) > return 0; > > /* > -- > 2.7.4 > > -- > 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