From patchwork Mon Jul 25 17:09:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9246061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 372FE6077C for ; Mon, 25 Jul 2016 17:10:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 258D4205AA for ; Mon, 25 Jul 2016 17:10:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18C01252D2; Mon, 25 Jul 2016 17:10:30 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7EAC205AA for ; Mon, 25 Jul 2016 17:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753012AbcGYRJq (ORCPT ); Mon, 25 Jul 2016 13:09:46 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35479 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752611AbcGYRJp (ORCPT ); Mon, 25 Jul 2016 13:09:45 -0400 Received: by mail-wm0-f68.google.com with SMTP id i5so17625402wmg.2; Mon, 25 Jul 2016 10:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=O5+m3+/20uS2wznKCuFAGWG4G5DvI7q+b8TssSMxQ8s=; b=MwByl9AUXQ0B/X1NmLZZD1s+OL3RJ8H4/Lm86orlNgwQmfgPQI+MvWCXJUIEjNxLlw /W68f9mYxOxPli1A0rq9Zbl42mCqaCQCqQFnDJP54rzotzwBfUM7KERhO8bR8l3DkEVA dEHOq123AMGzAWujVk4oQ8tna+fKGjAA3Kf9wuc2CQmhCRLqoBo6g+4QWWYulQPQLH/6 /s19E+1pVQqp7Tt7AEWyl+lWxEH8FArZMI98vx0abzBx6UJUsl0BWmNFNP7Klxhr1JR8 fuTXztoRz8ESsmXr6tM6ItHQRL35hVaHc644yLLu5rAZZ9+r5JdbgG8IYmXXLGDB/l0S OfGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=O5+m3+/20uS2wznKCuFAGWG4G5DvI7q+b8TssSMxQ8s=; b=OjNUgXXH/IVR7ZT6Atvt99Nck4N7cjhsPVkc0e/fgu78D1Ck/gZyWaRcEIM5rA5mSX GL+6094pVUxJs8AQ8PkQsGhahrXjaMWFVtFaLSlHcNzPXs0paY6f0NFI2Ks9XdecuFYn zI+NhJXsnHu3rAdlvPGkuA7SVfmKRXS+qVSUMD1AkAqvhLrQ4Pbu5DLLRkF1rB9SMzaU 2nMk3ODO9yI++utuV2e6UU1FpbHsuyUfb9Qaz9TRsEw8JxMC6CQmsTb7DH3oi9sSoOw/ UJsb1xSlPTL+nJ6hCaexdSeX5RTfWoLOclr7D7AX39sz7o+11YoGuYVXjLxEDxtDA2gj C2uw== X-Gm-Message-State: AEkooutEoT/MoKDfejXHgNRfm3cIp3XJpGvX9uFHNrlrT39sb2DFW6nhmwO1E+ax3yc1yg== X-Received: by 10.194.5.230 with SMTP id v6mr18126957wjv.92.1469466583872; Mon, 25 Jul 2016 10:09:43 -0700 (PDT) Received: from fisk.lan ([84.40.82.183]) by smtp.gmail.com with ESMTPSA id d8sm28420010wmi.0.2016.07.25.10.09.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jul 2016 10:09:43 -0700 (PDT) From: Nikolay Borisov To: zyan@redhat.com, sage@redhat.com, idryomov@gmail.com Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Nikolay Borisov Subject: [PATCH] ceph: Mark the file cache as unreclaimable Date: Mon, 25 Jul 2016 20:09:32 +0300 Message-Id: <1469466572-8939-1-git-send-email-n.borisov.lkml@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ceph creates multiple caches with the SLAB_RECLAIMABLE flag set, so that it can satisfy its internal needs. Inspecting the code shows that most of the caches are indeed reclaimable since they are directly related to the generic inode/dentry shrinkers. However, one of the cache used to satisfy struct file is not reclaimable since its entries are freed only when the last reference to the file is dropped. If a heavily loaded node opens a lot of files it can introduce non-trivial discrepancies between memory shown as reclaimable and what is actually reclaimed when drop_caches is used. Fix this by removing the reclaimable flag for the file's cache. --- fs/ceph/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 91e02481ce06..a8a6908078ee 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -672,8 +672,8 @@ static int __init init_caches(void) if (ceph_dentry_cachep == NULL) goto bad_dentry; - ceph_file_cachep = KMEM_CACHE(ceph_file_info, - SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD); + ceph_file_cachep = KMEM_CACHE(ceph_file_info,SLAB_MEM_SPREAD); + if (ceph_file_cachep == NULL) goto bad_file;