Received: by 10.223.164.202 with SMTP id h10csp1079404wrb; Sun, 26 Nov 2017 19:34:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMYtDM8k/YN8OgE40kOu2cmcpjxSWW1n6PCrnwpD41S/Li6tuv87Nxx0EzBs2C63/pUqysCn X-Received: by 10.99.122.3 with SMTP id v3mr34059395pgc.394.1511753652027; Sun, 26 Nov 2017 19:34:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511753651; cv=none; d=google.com; s=arc-20160816; b=YcQyBWJn49qCDlbXBU6Q5UJ249PS+vWyqZimukNKiFFunNpe6iZtdbHjVkv9f7ZtiV rrvvkNhPmY2rbtfquwkAi6Gg53xq9G3GvNt40idyEozAIXWPRtABPmqQgh4EoAry0Rba GvZJButAt3jjeHepvNLZsJH56FKjk+JYJT6lyF/DHsTzqE7AohH5M6KrIDN9srOlLKzA hk/UQe3A2z41qinAela8eEZ8skOXKCcxuaF7chLbfCrD8j7yUWdL5dDL9MweGzmOlJmy GYeZd//SD2h/kE4alVECLJFShiOnaKgJkRjiolLxOIE0rUA43uPNkixaIX5ZTRmeA+BH 7sNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=m3lzOiYWIgPJw7wbdx7MrrSk8MdMDMupkeAvQCiepVA=; b=uH4fNtt5O5Fpt31sMds+V+5uNdbyHLmM/z0bqLqHeYS7AoBYWe6juQ611G71rtQ8M8 8OkvlJafDKHKkn4joexbICKfmdxzlb7Q5gtxwwvHRH/VycPrgbxWaAnIuaxqfWotVXBY KGyWB/Ei72s63T1iv340F7GwyDMjTvNuEnZmP2F9BX0De/AXiks8QfuFjR4UpAkROe0n FPi7DU+cgNdR5Dg8SMKd8WcZRsrBh9BEcQEdLdUF5J32CEOOizNCnI+LbwgsfK9+fcmU 0xh1oBSwE2ZxGwypZNg9SEqt0DoS7PZt7gmix4Zx4V8IomFainNgfM0CSB5+tH6bDswj sKgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si22956845plm.768.2017.11.26.19.33.53; Sun, 26 Nov 2017 19:34:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751252AbdK0DdB (ORCPT + 77 others); Sun, 26 Nov 2017 22:33:01 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:65016 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751078AbdK0DdA (ORCPT ); Sun, 26 Nov 2017 22:33:00 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 83574B13C7BB778D8369; Mon, 27 Nov 2017 11:32:57 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id vAR3Wjng041013; Mon, 27 Nov 2017 11:32:45 +0800 (GMT-8) (envelope-from jiang.biao2@zte.com.cn) Received: from localhost.localdomain ([10.75.10.200]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017112711324700-2596621 ; Mon, 27 Nov 2017 11:32:47 +0800 From: Jiang Biao To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn, zhong.weidong@zte.com.cn Subject: [PATCH] fs/mbcache: make count_objects more robust. Date: Mon, 27 Nov 2017 11:30:19 +0800 Message-Id: <1511753419-52328-1-git-send-email-jiang.biao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-11-27 11:32:47, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2017-11-27 11:32:45, Serialize complete at 2017-11-27 11:32:45 X-MAIL: mse01.zte.com.cn vAR3Wjng041013 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When running ltp stress test for 7*24 hours, the vmscan occasionally complains the following warning continuously, mb_cache_scan+0x0/0x3f0 negative objects to delete nr=-9232265467809300450 ... The tracing result shows the freeable(mb_cache_count returns) is -1, which causes the continuous accumulation and overflow of total_scan. This patch make sure the mb_cache_count not return negative value, which make the mbcache shrinker more robust. Signed-off-by: Jiang Biao --- fs/mbcache.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/mbcache.c b/fs/mbcache.c index d818fd2..b8b8b9c 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -269,6 +269,9 @@ static unsigned long mb_cache_count(struct shrinker *shrink, struct mb_cache *cache = container_of(shrink, struct mb_cache, c_shrink); + /* Unlikely, but not impossible */ + if (unlikely(cache->c_entry_count < 0)) + return 0; return cache->c_entry_count; } -- 2.7.4 From 1585149241262653622@xxx Sun Nov 26 17:08:39 +0000 2017 X-GM-THRID: 1585149241262653622 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread