From patchwork Thu Aug 30 21:55:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 10582913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99BFB5A4 for ; Thu, 30 Aug 2018 21:55:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89B982BE90 for ; Thu, 30 Aug 2018 21:55:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D4E32C24B; Thu, 30 Aug 2018 21:55:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB1372BE90 for ; Thu, 30 Aug 2018 21:55:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AFEB16B5393; Thu, 30 Aug 2018 17:55:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A841F6B5395; Thu, 30 Aug 2018 17:55:29 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94D986B5396; Thu, 30 Aug 2018 17:55:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f200.google.com (mail-qt0-f200.google.com [209.85.216.200]) by kanga.kvack.org (Postfix) with ESMTP id 571F36B5394 for ; Thu, 30 Aug 2018 17:55:29 -0400 (EDT) Received: by mail-qt0-f200.google.com with SMTP id d1-v6so10445870qth.21 for ; Thu, 30 Aug 2018 14:55:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=CCBS3Wuve8RiXTWHGrwTznKM/VN762uDCXQIsdJF4Ag=; b=AuPY+Swc7W4M43bpA5hrjmrvetnffQHurHdWIcZQkn86GRnF1sWRzTXP1RuzK1JvBy sJSWBCC/jana6Z2EheShu3A7XUTQ7n+4GKL+F0gZgELxJVzOsfzoH20kEjIctUM5giOg 6dUBpvNedZZdDu3Ry/nLqBfWUel96DoOmQytxdE3CJ6P5Lshc0Y8vIswbc2bLtFuz0Bf mS7809xP3JiBotdFDJPGQrnrNzDyAiIIbytNgrmHOrrjb3o70/2lbu7/b3FFEidPSQ7M bynkgFiw5bfotuURK8jrtgAz0DS9nTCc3bauQIqgqUYgBMKcWs8ZwuzheiiY42QEPgzt Qjaw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of longman@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APzg51Dil9IvlVsbm7lEszBXM8XebL2sxkpQ/orLGO2DS0wxrpobRysE xrStNgylobVP1OLVU8FQ1PxhaRX/J+KQxhAp/wtgeft4bmXy0GolO3Ib+eH7bn/WmNCf4VpeIRa CI8hxgHFyniLppFR+NjtpQMx/xdDhQi//YTL/nXlmza5HGtbqtj8HYeGFkY8L3LL1oA== X-Received: by 2002:a37:b12:: with SMTP id 18-v6mr13271576qkl.167.1535666129117; Thu, 30 Aug 2018 14:55:29 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYACnBmPD7d/eg9BxvDSiARGhVBxaiudFlBnfZk2DETu1PCBQQIYrtcJrSDYgzHVsocY8ji X-Received: by 2002:a37:b12:: with SMTP id 18-v6mr13271558qkl.167.1535666128529; Thu, 30 Aug 2018 14:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535666128; cv=none; d=google.com; s=arc-20160816; b=GLyEskvIVBQryZDln78OhCCKoiXi0ZBtMinCewE/VzGZaiKn5mv5CafxifsDOo3j4v zIqS9KQaZgggNW6cc+3BLPZMvcGCWsu89ycLEfz8w+F32xVhh5JDTTqmKa8MM4guW+o2 GmdxnpdguIgBGUdphyx5oqQ3ofPcenSA8CYnzU1xcUWC8kML6oIM/uIAyJUxcoDXYe33 nX1MFqwOgnUgL5+KLtzYNyCNsg4lI1ivKIIbr3o84OQHl8ZmgHdySSknHZIVTd7YkKKK 625k/xhcNPFxeGRg7W0ho94T4aP0fUEFnWW0Pjv1dQW07o/VLhZMHVlHMy500PJUbgJ0 VLjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CCBS3Wuve8RiXTWHGrwTznKM/VN762uDCXQIsdJF4Ag=; b=Biv/H8rcsQb69SA/HXZ6WlcWHwWNNNBadvrpLAuXM6L2Nur5MKNNamChARJ1qgN1hT M6Y/sxhnVbIoUItr2wyXt/yoo2tf0MPtsx1VBB/HMQEx/A6AYi8NbyE4znoHUIoxt1oJ erUuwVz0Oi4kkknOQFcWoaaDfMFl6YkdzozxSE+l/1U8jsvlsgO+Ruj6gjju+Y2bn4xZ pEBAfa4HzynNIAJby4LzHb9nLk0GpklnZXkhKn9F4Dvs1gLSqG5v0OoYeHulafB+SKrY aBUliMvPCT+ARc7yluEbgKNGcuNdPquKAX5B4ylPNVh9ZD9tpcBu64IW2kwGhAE/u7Yr MNmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of longman@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id m22-v6si1051503qtg.95.2018.08.30.14.55.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 14:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of longman@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of longman@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1FFA7788D; Thu, 30 Aug 2018 21:55:27 +0000 (UTC) Received: from llong.com (dhcp-17-8.bos.redhat.com [10.18.17.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 325FD2157F49; Thu, 30 Aug 2018 21:55:27 +0000 (UTC) From: Waiman Long To: Alexander Viro , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, "Luis R. Rodriguez" , Kees Cook , Linus Torvalds , Jan Kara , "Paul E. McKenney" , Andrew Morton , Ingo Molnar , Miklos Szeredi , Matthew Wilcox , Larry Woodman , James Bottomley , "Wangkai (Kevin C)" , Michal Hocko , Waiman Long Subject: [PATCH v2 1/4] fs/dcache: Fix incorrect nr_dentry_unused accounting in shrink_dcache_sb() Date: Thu, 30 Aug 2018 17:55:04 -0400 Message-Id: <1535666107-25699-2-git-send-email-longman@redhat.com> In-Reply-To: <1535666107-25699-1-git-send-email-longman@redhat.com> References: <1535666107-25699-1-git-send-email-longman@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 30 Aug 2018 21:55:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 30 Aug 2018 21:55:28 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'longman@redhat.com' RCPT:'' X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The nr_dentry_unused per-cpu counter tracks dentries in both the LRU lists and the shrink lists where the DCACHE_LRU_LIST bit is set. The shrink_dcache_sb() function moves dentries from the LRU list to a shrink list and subtracts the dentry count from nr_dentry_unused. This is incorrect as the nr_dentry_unused count Will also be decremented in shrink_dentry_list() via d_shrink_del(). To fix this double decrement, the decrement in the shrink_dcache_sb() function is taken out. Fixes: 4e717f5c1083 ("list_lru: remove special case function list_lru_dispose_all." Signed-off-by: Waiman Long --- fs/dcache.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 2e7e8d8..cb515f1 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1202,15 +1202,11 @@ static enum lru_status dentry_lru_isolate_shrink(struct list_head *item, */ void shrink_dcache_sb(struct super_block *sb) { - long freed; - do { LIST_HEAD(dispose); - freed = list_lru_walk(&sb->s_dentry_lru, + list_lru_walk(&sb->s_dentry_lru, dentry_lru_isolate_shrink, &dispose, 1024); - - this_cpu_sub(nr_dentry_unused, freed); shrink_dentry_list(&dispose); } while (list_lru_count(&sb->s_dentry_lru) > 0); }