From patchwork Tue Sep 11 19:18:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 10596191 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 811F014F9 for ; Tue, 11 Sep 2018 19:18:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78EED29BD9 for ; Tue, 11 Sep 2018 19:18:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C2C429D13; Tue, 11 Sep 2018 19:18:41 +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 E4AA029D0A for ; Tue, 11 Sep 2018 19:18:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E69598E0002; Tue, 11 Sep 2018 15:18:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E330C8E0001; Tue, 11 Sep 2018 15:18:36 -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 B9A938E0003; Tue, 11 Sep 2018 15:18:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by kanga.kvack.org (Postfix) with ESMTP id 916408E0002 for ; Tue, 11 Sep 2018 15:18:36 -0400 (EDT) Received: by mail-qk1-f198.google.com with SMTP id w142-v6so21547771qkw.8 for ; Tue, 11 Sep 2018 12:18:36 -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=ELeTSBjgMvbTlW0Bg+46/ZdfSJsinXaKosjIYOzQJMwaoQFso/5voNc9iNShX9zyPp v/5XqK0ZNW4C6Op4vd7aZtJXnolS6uAj5BOeEDyUCi/6Hi2POBUxQo+d/jhykqMD9Dgw Y4ElX2TaWZxnjY2ymVAeF6D1CK6UdEjqtZmYFfJ1ZrcW+YEnjIKDZyhfXdO0UMqsRdd4 MJzs7Dn3FS83papEFHnpEJeHXo+N9iE90Hq795PQJ+2yAcdoJ9grmEdDbSdC4Fy2AYGq Va+MWBtxo5hJOO8JxKxBRGFdMLboV7L0iK4DkrY4HZ5xuzTuaAb7q7qf5yQHYjLneAfJ g3kg== 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: APzg51BLI55VRUZRQVQqXZoyxxh2nGb9F+cM9LWSickpzSSbqTbg0cBn v+Z/HVFZaAqOT0yhSsn2sD3Y3d/UZNMmEwjeu5LoOkqYbeP21SnXoZwVN6qMleoX90dId19txsA bXKdkH5u+ANMo3NrU5kt8qz/ZhT/a5W9qGN0+LmE5R0WBi0CN425tfbUEj1Z/6PYpuQ== X-Received: by 2002:a37:5e03:: with SMTP id s3-v6mr20358350qkb.339.1536693516358; Tue, 11 Sep 2018 12:18:36 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYJdB11OHPMtYd48FuQoKV9oeXPhqcXXoKkrHAzJjPnJnhFO7O4PTudQoUraESCqmrcpvhy X-Received: by 2002:a37:5e03:: with SMTP id s3-v6mr20358323qkb.339.1536693515830; Tue, 11 Sep 2018 12:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536693515; cv=none; d=google.com; s=arc-20160816; b=gPV/Hpsat2LWixXT2lPhicoAoXW6WQEYix2/OWHfVebtmRGy8UEX7uh2WQ7S1eO+5m iehUr3POiC4LTcBrKe+j8DXQyetY8EJMQnG+xHXHh8trasZEpnsrulfoyN/kr5fRhmmD jz49nwwUEytdYVxf5pXkzjoMrZFru0mDTpLwGverIOFDYNSiKCtWJ/Dgt5obkC7zcWhN ZuGX0tRQPax4DagTE8vMrda2kRHC2PPz4sE+JaNUjNrWH5pXenY6f//+Am4xmvqnOtb9 qHr8dW8pkwoop2sZ9h1Jn7tniBIzh3ChzYQbP0VVM4mWf0BjVsdmTJ/csG6N5uPbp7tb GdcQ== 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; bh=CCBS3Wuve8RiXTWHGrwTznKM/VN762uDCXQIsdJF4Ag=; b=P94qqrLa9291kKWB39aaSAhEeeYoz84GN9LaFwGSG9XERMGedy72fiPG/m15h4fDsJ KhI56y7ldlfMSXgKuuYYM7d2nOUO6Bzo0LCR+nXZMLG7co1ZeQxmJm0QoyQWadgtDyFs Y/obereE5q1JIbr2iAfFwfXk11DTvsM9u//DDZ6zM8zmuilu6j9NQxNR8pHkRNPkZeY0 oymW7WNXzE9hGHKefuDGxxf917yTncoe+MedzM8LlTtDm7eJ8sVx+n2YPdt00mhox8wT 9yH1UT9SYmKVYgELhujGtbsEFMDsZ+r0JBhuxvRSNJFMKYKShtb7j5IDoHCvh3UAKtHl oefA== 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 o53-v6si251233qtk.150.2018.09.11.12.18.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 12:18:35 -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 6591E804B4DB; Tue, 11 Sep 2018 19:18:35 +0000 (UTC) Received: from llong.com (ovpn-123-172.rdu2.redhat.com [10.10.123.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B3092157F4A; Tue, 11 Sep 2018 19:18:34 +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 v3 1/4] fs/dcache: Fix incorrect nr_dentry_unused accounting in shrink_dcache_sb() Date: Tue, 11 Sep 2018 15:18:23 -0400 Message-Id: <1536693506-11949-2-git-send-email-longman@redhat.com> In-Reply-To: <1536693506-11949-1-git-send-email-longman@redhat.com> References: <1536693506-11949-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.8]); Tue, 11 Sep 2018 19:18:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 11 Sep 2018 19:18:35 +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 Reviewed-by: Dave Chinner --- 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); }