From patchwork Tue Oct 25 18:41:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9395205 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 F01786077F for ; Tue, 25 Oct 2016 18:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E242B2970D for ; Tue, 25 Oct 2016 18:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B247F29715; Tue, 25 Oct 2016 18:42:46 +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_SIGNED, 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 3704429712 for ; Tue, 25 Oct 2016 18:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759415AbcJYSmh (ORCPT ); Tue, 25 Oct 2016 14:42:37 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:54534 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932538AbcJYSmb (ORCPT ); Tue, 25 Oct 2016 14:42:31 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9PIci40000629; Tue, 25 Oct 2016 11:42:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=/6Qdln9kjoq0wsUGJ0AfowGIAgko7JRgfIyIbNu/DVQ=; b=Lbq0MZ1jTh5YIaGak5GUbKPxFQGamchT1nf0lVr9BZLQv24NKFcAnyfctfPluM8y2ije ytFdxBmzv1yyhKy2jS6aSX9hy+0SymKWSOtO+fTOf93OSvL1WokSsi15Z+9CJBztVv+I BTVdM3n5o3tWhn36LQQwbdF6d999JiiVPIw= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 26abems05j-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 25 Oct 2016 11:42:08 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.28) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 25 Oct 2016 14:42:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=OL81Vsp1uqVJaKP3ec+66watVLKYdEK+B+ZZyXNrIg8=; b=Y7l8ZxQ7TgPNClYwd1R4+yFTyaL3FlPtcBgNo2s1wprd3/4FVJiLIYYk2GGnYKUuXcb7tXassTU/w4E03gvQAsdg7FTgJ0+IGnjhd6sL+YazaaQxK8Wc74WQ1di5IEvWDSaRCQMdA5A0/cwLrN7fa5VJuG5AZPRalzOd90pVthQ= Received: from localhost (2606:a000:4381:1201:225:22ff:feb3:e51a) by DM5PR15MB1324.namprd15.prod.outlook.com (10.173.210.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Tue, 25 Oct 2016 18:42:04 +0000 From: Josef Bacik To: , , , , , , , Subject: [PATCH 3/5] writeback: add counters for metadata usage Date: Tue, 25 Oct 2016 14:41:42 -0400 Message-ID: <1477420904-1399-4-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477420904-1399-1-git-send-email-jbacik@fb.com> References: <1477420904-1399-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [2606:a000:4381:1201:225:22ff:feb3:e51a] X-ClientProxiedBy: CY4PR09CA0018.namprd09.prod.outlook.com (10.172.65.28) To DM5PR15MB1324.namprd15.prod.outlook.com (10.173.210.14) X-MS-Office365-Filtering-Correlation-Id: 4516a674-e622-413e-15dc-08d3fd069dc5 X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 2:mAtiRfjDf218l/L5L6Ixx4rzfvsxlXMJxFTLGGkl/A++aQf+BxDEBn1DwzqO97xGJpjedGJhTodiEd59N7GFNFJGgr+4Je9a4i+VguSjyegaekOxoBa5O+ATRzxOXx76e+uyu91dojuhF3ryoRHNQOT4J5c6Y41WoJNSX66NoJ7GbNH9qPU3cozf/XX2Li+LQ109SQ61JsX5iGvqjswa5Q==; 3:D6N/esP5KFJxNxM6koF3mlVb9fSaSimgbS4DbTp5qQ6ZgebZBKBgONWrB+5n61N92GkBEndvI198+hweVZ2TGkqOLs4ka1W4o1vdZVTjZ6tBMI0aRjgT9hG1kO0oWfqaIIZk1eYGVhhJUYCeNrwlmQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR15MB1324; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 25:JaDARPi6VYz3dsqE9sDdt6hqRyG/yir6AIbc+HNnSZYKqgF0jaWSN3JZs7GU4DQCANJPmC8ZjdNj3HrInZBJmYRbF04Gd6zJLS6wsPzC/HjtQLVzZT8GXd0EStsXfrokl0cexLUsCylQ50lbmsOs3OcDvuLT/qFEfyBPqiCH0QwYX050wIf4iRm12bNL5QA97eb3cwjucuXqwzqcFZurvNGrjwT5PUqnWl8EsvDy8CinlDClQEfbzyVzYUegYw1H6o+JVTGv1xTEicXkOG4Tq0nScJ3U8yNL0DfE458g3mysbS//N/rq5Bl2cXpZIVtNp8vk55ddyOKXCn80SspcWbErwSV8oyOlNPANDctw+umNDKQLdVsCgqW3bAF8TbqFypHZNGq1iMlLMRPu+3xRY4rHeJn0qMUO2vqPqzF+k9yAO7HtYylzjgXndZLpeoqjb5KZVBYbO/HSh3e0OoLBtKmEnyy9O3thL6PsmYcrrHsdyfQkCT/dOsdkeS3dCnmAftLvt8X40V4PUSjcw7zTZVUWL/4h93sWO97cqAsmGOjlSsa9N+LnL9lYta4R14Uewfy0y43+ZZdrcEuaaNehiC4rzzQyeA50TG+Lu+YKpeCFBHPkF28WicIj3Q/GAX42L6atHpkriwC702arvb1ZyMP9YOzSXW3iNGuvjYw57hiPNwXBx66AMKpYDeVeGnlPSvlg1VrbYVS3q3Ky9Z2VdZvbUgBN7iQtWu1sD9A6uX3F3tAui9zaPqHiELwpkWVC X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 31:t1V7jDy86v+UIYsxp6fbjpJG8Yv3VCNcFOa5rPjE8BPdrPSRPPNe/+qLGnEijNMDpfvp/kBA4Cu2rnC2OTyPNsXTKPi3WLfNtZKwT48Pgu2yuNKe+t+X5q1IN40j6i3/XJGFRxJ9b9lVml4LyzzKq0rzwVEBaXmYfGKSn/Z1BzD+uucl7ISWHXNC0gXBCnIZNVkHz32IO7m757E1qplOFPWWri04aBmXbzchb496DXOgaQY6bMmwtlZZr0cQEwGjw9fbx5u3Lu4jDn/vNfesUg==; 20:V2OIq7T4K/HBjpOqr3l6fUJEep6Do2Awlo0KqUPvds5HOpaXmooEDZdGMuDH6UbG/xU+/vw7EDvydKWgOwec5d4OKkWbrsbaqpmPBNjwmghcLmQF8VNdhaoXzppruYjH7srZoC+zSUCQ3/1+lR/KrFBDKqxznIQyqDfAZu0uMyA=; 4:qHhhqjR9Ftsj6YJ0z7ckF/icR0PLZYFKjiVHExYg8fP2sijeFDtvyEEk199K+w+moUNPI1BlywKftkZNjUT8fUWJ25RzCGvnK3OlSX2VP6+cWolxPqHCrG3ze3/u6N2TpM2wEKg5lWrAIVWX/GjVQFn8enYpUP/TGFR7jaall61m0tzH4H3QjRkzGVYej/p9bNEuCWZ9LHCL0PbSR1hZ0c5j6mwvdJS6JXOdN/d4YcCwroI646ga9VfC1nqlZgFwRGWfem8yJXIkbUI80sFbC2+sto1YMw7KZ89uaGuHoPy+NHp6fLB3LHsPFqSDRxN15B455jcIIXoSbACYbF9byDiyutsMnR8MfZ70VVzHNOVrF2uM9AHzOIlAFlZqgBomJ+jgz93cvF8ri3ltOznE5Jh60QWxL1e7Ad4u9+ivV+sqQBG1+fc55GTPSUV+EKVwy9Vlndvc8fzGaw7cmfNzGi4W0/3k7v JE6Z/eNMEB7iM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863)(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:DM5PR15MB1324; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1324; X-Forefront-PRVS: 01068D0A20 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(5001770100001)(97736004)(305945005)(50466002)(5660300001)(36756003)(48376002)(229853001)(101416001)(76506005)(76176999)(42186005)(105586002)(50986999)(189998001)(6116002)(107886002)(7846002)(7736002)(5003940100001)(586003)(33646002)(2906002)(19580395003)(6636002)(6666003)(106356001)(68736007)(19580405001)(92566002)(77096005)(81156014)(2201001)(81166006)(8676002)(86362001)(47776003)(2950100002)(50226002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR15MB1324; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR15MB1324; 23:qbZX/ob+GrahOiNT3X3p1EYdUKvU+RAZEXkA14OMi?= =?us-ascii?Q?SO1Cx3Ocs74dSkHwHenQ6g4TSqjf46PDfLfcFF3qeIxo1e8lf/PGt6HkjwT6?= =?us-ascii?Q?WDC5RouAX3jb8GPrPwGU8EtC7iDEnUuO6pjah4sxd128+k6GmKwvllPxKXWZ?= =?us-ascii?Q?mLnMkb22WTj45h6AOz62t8pk8BSUMbe/5DnyBjkHGoId5o0kxLMunrTfuaMJ?= =?us-ascii?Q?o08ddmapPq2owjBm74qE+oU2PXhpk2BC9jS5jJBtbKgINpyCjzMC61FCGkEy?= =?us-ascii?Q?aPs8HtKckkazQht5keXGzk9u5lDXwE25v5aACH2UU3THqwmbdhTjN2fIo4HN?= =?us-ascii?Q?CUk5SfDpksUaMAJKyxstIhdtO7t5tBF8EgKo5BCmJAIp9864dNOO6SmcFHSU?= =?us-ascii?Q?eP+Am0hMKvmd3aS2YmJoIHtFZY77cS+2WOptLygdTqDwPFSJEBZcHapt5ySK?= =?us-ascii?Q?cIYl+a7D37LwP7ScqL9tobZoC59i8ULcb1K8PER7aP9zBJu3pZZIV4NKx32D?= =?us-ascii?Q?nxzQp9FldbS/6phY6xof52M4hhugwq1i6nI2YP/hSbKE/pnIKxxyOtucuYQF?= =?us-ascii?Q?c0spUlW6iVF0EUgcT1t9MIHvjfedj175DHwVIK6Sn314lcrJP4UQqLX50TWm?= =?us-ascii?Q?4vx2HefLRUUdfzncRzM5F2kzfQ3uv1Cgpa7A7QjkmaEjQkJqZBoRKOjuAXeP?= =?us-ascii?Q?v5lzZPQWyuFZ1JmVBStf6bPMPhigbHcFy0B2BVu9+MeAoDbbsugILbfmIXs6?= =?us-ascii?Q?qT8cwDMVCYe6f/+tyfXugANl2PhVr2FmOFoN1Qsod7aaoG1AaxMCAwuAd9fZ?= =?us-ascii?Q?SkGuKb7N4scK5dwvVQspdp3WEx7XSn9soHCWFdVF86HFM8DdBCO5SL31vD1y?= =?us-ascii?Q?WVW7ezPjuNJW/3W3fkwG313m7QK4RJvaTTySSLcC4pqEnK+sEz//0kQ3/U7n?= =?us-ascii?Q?ayZDt/lQ6Bx52SaiqfnddDdVgBlYdv8dhVM9MPIhQO1niL3uGlKEmAHE4aq0?= =?us-ascii?Q?lSBB8HWkUNvd+lEC0HK8ijAphJbiN58wJw80BjCqPhx7nIMVnLXOgtYq3BW2?= =?us-ascii?Q?1TnWOsbnjQuo8pzHM51WbHv3yB6ZGAfPQprhqE00JxZ+qlmfPDqJixdHH1ts?= =?us-ascii?Q?4VFOQ9n8HTF/GZc10BiquvsL/P4QioM?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 6:FalXgaeAeJcLJRB3AUeV/9fCVJkfA2eH2DNndcC+puyW6bGD5ZBKfMm3cOtka9x19hNCT9c8gIgmq+JzWHAnKQGxLb8ug8Pu5DN5d8OEZZ5qpcqenBdn5KFr+srSknv2AMwPz5G5eKZhszYbPMKczWGdJ3drTdtfI2G21dk9kIj5aRGak1QQFxd0TRqrEVlEUEXhkypNSm1doe1ZPj+EWezZuxtRXcB7GAl78aw+OMgzJNTXlL9IYDr5SnvEKeBr+NJjl2pgIbI+gcF3OjLzW6cEHpaXvnJLIy9aNA1WzuT438OQb84/jqw78Ld5wLqS; 5:oGZMe7vCP11rBta9DDLFRJQnWQmfOBImA+emJo3KqSfOcSleQLScGY3KW8GdJytJBQ0s7J42+j2duKAt7xHTYSAqNs+l+24cD88kt9dRVedncdMcpQcHrM54/+MBEe/Ydi6FHYPCFUc91qp5r2sG5oT9qPSPJy3NCnQETv745Pg=; 24:Ps9nvGyXIUlmUfq9uz5tXAjTozOimKv9UFp/hVhmDfsSYAhzj6GBJr+GMnHRFh0+8H93+G59nLn5rgWXC66+WC7yfvFIsJT0bMhFcO2/ASk=; 7:T/unlAlf8vjVUFc4yqgeR+th8iJaRkOniW1E1T2He1nDP7L1+jygqw1tiAxoR/6zKSxk2bqvFa3kzwlKyG+JbJOxwg5Wh8q479zQkxbIS/pNKRSeHk51pzZIsZ6ZHbTxOa1fbG+3LFv/sYzK6pKZvVRsyS+VOMgM8/fS+jealjACYReClVeM1c3KQiLazY1Dvmk5/cr4BerO8w2bSOYVLb6exgpdGFPg4KBGYCWBDSjXAFx74vlH2aJMmX0/LRHJjR6dKanv8iDK/aYjAIRnFeLfdXkTHl78d6VQ8oTGYN1eYXQhx7FP1d/0lkoURQNSrNaL7Wxl fdWyWDLhOlsNI2yQm+paCe2ntYN4A6m+OQc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 20:s3nI2JPnGVmYiBCMa5I5tQOQFrh/cG84Szu/Vk683wXEDlCAKfEe7LLQWmtFX+VmQHynIfOHVLjZk6UkuvoeeAbGWfz4QHOtR896pKvHT3KF6Of2iFEnVDXhkKPLHCV9920beFE8obiQbf5JEkHudRCUEJuwRIa6Yqc7Uo5kw/8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2016 18:42:04.5379 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1324 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-25_17:, , signatures=0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Btrfs has no bounds except memory on the amount of dirty memory that we have in use for metadata. Historically we have used a special inode so we could take advantage of the balance_dirty_pages throttling that comes with using pagecache. However as we'd like to support different blocksizes it would be nice to not have to rely on pagecache, but still get the balance_dirty_pages throttling without having to do it ourselves. So introduce *METADATA_DIRTY_BYTES and *METADATA_WRITEBACK_BYTES. These are zone and bdi_writeback counters to keep track of how many bytes we have in flight for METADATA. We need to count in bytes as blocksizes could be percentages of pagesize. We simply convert the bytes to number of pages where it is needed for the throttling. Also introduce NR_METADATA_BYTES so we can keep track of the total amount of pages used for metadata on the system. This is also needed so things like dirty throttling know that this is dirtyable memory as well and easily reclaimed. Signed-off-by: Josef Bacik Reviewed-by: Jan Kara --- arch/tile/mm/pgtable.c | 5 +- drivers/base/node.c | 8 ++ fs/fs-writeback.c | 2 + fs/proc/meminfo.c | 7 ++ include/linux/backing-dev-defs.h | 2 + include/linux/mm.h | 9 +++ include/linux/mmzone.h | 3 + include/trace/events/writeback.h | 13 +++- mm/backing-dev.c | 4 + mm/page-writeback.c | 157 +++++++++++++++++++++++++++++++++++---- mm/page_alloc.c | 20 ++++- mm/util.c | 2 + mm/vmscan.c | 19 ++++- mm/vmstat.c | 3 + 14 files changed, 229 insertions(+), 25 deletions(-) diff --git a/arch/tile/mm/pgtable.c b/arch/tile/mm/pgtable.c index 7cc6ee7..a159459 100644 --- a/arch/tile/mm/pgtable.c +++ b/arch/tile/mm/pgtable.c @@ -44,13 +44,16 @@ void show_mem(unsigned int filter) { struct zone *zone; - pr_err("Active:%lu inactive:%lu dirty:%lu writeback:%lu unstable:%lu free:%lu\n slab:%lu mapped:%lu pagetables:%lu bounce:%lu pagecache:%lu swap:%lu\n", + pr_err("Active:%lu inactive:%lu dirty:%lu metadata:%lu metadata_dirty:%lu writeback:%lu metadata_writeback:%lu unstable:%lu free:%lu\n slab:%lu mapped:%lu pagetables:%lu bounce:%lu pagecache:%lu swap:%lu\n", (global_node_page_state(NR_ACTIVE_ANON) + global_node_page_state(NR_ACTIVE_FILE)), (global_node_page_state(NR_INACTIVE_ANON) + global_node_page_state(NR_INACTIVE_FILE)), global_node_page_state(NR_FILE_DIRTY), + global_node_page_state(NR_METADATA_BYTES) >> PAGE_SHIFT, + global_node_page_state(NR_METADATA_DIRTY_BYTES) >> PAGE_SHIFT, global_node_page_state(NR_WRITEBACK), + global_node_page_state(NR_METADATA_WRITEBACK_BYTES) >> PAGE_SHIFT, global_node_page_state(NR_UNSTABLE_NFS), global_page_state(NR_FREE_PAGES), (global_page_state(NR_SLAB_RECLAIMABLE) + diff --git a/drivers/base/node.c b/drivers/base/node.c index 5548f96..9d6c239 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -51,6 +51,8 @@ static DEVICE_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); static DEVICE_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); #define K(x) ((x) << (PAGE_SHIFT - 10)) +#define BtoK(x) ((x) >> 10) + static ssize_t node_read_meminfo(struct device *dev, struct device_attribute *attr, char *buf) { @@ -99,7 +101,10 @@ static ssize_t node_read_meminfo(struct device *dev, #endif n += sprintf(buf + n, "Node %d Dirty: %8lu kB\n" + "Node %d MetadataDirty: %8lu kB\n" "Node %d Writeback: %8lu kB\n" + "Node %d MetaWriteback: %8lu kB\n" + "Node %d Metadata: %8lu kB\n" "Node %d FilePages: %8lu kB\n" "Node %d Mapped: %8lu kB\n" "Node %d AnonPages: %8lu kB\n" @@ -119,8 +124,11 @@ static ssize_t node_read_meminfo(struct device *dev, #endif , nid, K(node_page_state(pgdat, NR_FILE_DIRTY)), + nid, BtoK(node_page_state(pgdat, NR_METADATA_DIRTY_BYTES)), nid, K(node_page_state(pgdat, NR_WRITEBACK)), + nid, BtoK(node_page_state(pgdat, NR_METADATA_WRITEBACK_BYTES)), nid, K(node_page_state(pgdat, NR_FILE_PAGES)), + nid, BtoK(node_page_state(pgdat, NR_METADATA_BYTES)), nid, K(node_page_state(pgdat, NR_FILE_MAPPED)), nid, K(node_page_state(pgdat, NR_ANON_MAPPED)), nid, K(i.sharedram), diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 05713a5..a5cb1dd 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1802,6 +1802,7 @@ static struct wb_writeback_work *get_next_work_item(struct bdi_writeback *wb) return work; } +#define BtoP(x) ((x) >> PAGE_SHIFT) /* * Add in the number of potentially dirty inodes, because each inode * write can dirty pagecache in the underlying blockdev. @@ -1810,6 +1811,7 @@ static unsigned long get_nr_dirty_pages(void) { return global_node_page_state(NR_FILE_DIRTY) + global_node_page_state(NR_UNSTABLE_NFS) + + BtoP(global_node_page_state(NR_METADATA_DIRTY_BYTES)) + get_nr_dirty_inodes(); } diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index b9a8c81..72da154 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c @@ -36,6 +36,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) * display in kilobytes. */ #define K(x) ((x) << (PAGE_SHIFT - 10)) +#define BtoK(x) ((x) >> 10) si_meminfo(&i); si_swapinfo(&i); committed = percpu_counter_read_positive(&vm_committed_as); @@ -60,6 +61,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) "Buffers: %8lu kB\n" "Cached: %8lu kB\n" "SwapCached: %8lu kB\n" + "Metadata: %8lu kB\n" "Active: %8lu kB\n" "Inactive: %8lu kB\n" "Active(anon): %8lu kB\n" @@ -80,7 +82,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v) "SwapTotal: %8lu kB\n" "SwapFree: %8lu kB\n" "Dirty: %8lu kB\n" + "MetadataDirty: %8lu kB\n" "Writeback: %8lu kB\n" + "MetaWriteback: %8lu kB\n" "AnonPages: %8lu kB\n" "Mapped: %8lu kB\n" "Shmem: %8lu kB\n" @@ -119,6 +123,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) K(i.bufferram), K(cached), K(total_swapcache_pages()), + BtoK(global_node_page_state(NR_METADATA_BYTES)), K(pages[LRU_ACTIVE_ANON] + pages[LRU_ACTIVE_FILE]), K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]), K(pages[LRU_ACTIVE_ANON]), @@ -139,7 +144,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v) K(i.totalswap), K(i.freeswap), K(global_node_page_state(NR_FILE_DIRTY)), + BtoK(global_node_page_state(NR_METADATA_DIRTY_BYTES)), K(global_node_page_state(NR_WRITEBACK)), + BtoK(global_node_page_state(NR_METADATA_WRITEBACK_BYTES)), K(global_node_page_state(NR_ANON_MAPPED)), K(global_node_page_state(NR_FILE_MAPPED)), K(i.sharedram), diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 71ea5a6..b1f8f70 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -36,6 +36,8 @@ enum wb_stat_item { WB_WRITEBACK, WB_DIRTIED_BYTES, WB_WRITTEN_BYTES, + WB_METADATA_DIRTY_BYTES, + WB_METADATA_WRITEBACK_BYTES, NR_WB_STAT_ITEMS }; diff --git a/include/linux/mm.h b/include/linux/mm.h index ef815b9..8b425ae 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -31,6 +31,7 @@ struct file_ra_state; struct user_struct; struct writeback_control; struct bdi_writeback; +struct backing_dev_info; #ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */ extern unsigned long max_mapnr; @@ -1363,6 +1364,14 @@ int redirty_page_for_writepage(struct writeback_control *wbc, void account_page_dirtied(struct page *page, struct address_space *mapping); void account_page_cleaned(struct page *page, struct address_space *mapping, struct bdi_writeback *wb); +void account_metadata_dirtied(struct page *page, struct backing_dev_info *bdi, + long bytes); +void account_metadata_cleaned(struct page *page, struct backing_dev_info *bdi, + long bytes); +void account_metadata_writeback(struct page *page, + struct backing_dev_info *bdi, long bytes); +void account_metadata_end_writeback(struct page *page, + struct backing_dev_info *bdi, long bytes); int set_page_dirty(struct page *page); int set_page_dirty_lock(struct page *page); void cancel_dirty_page(struct page *page); diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 7f2ae99..89db46c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -169,6 +169,9 @@ enum node_stat_item { NR_VMSCAN_IMMEDIATE, /* Prioritise for reclaim when writeback ends */ NR_DIRTIED, /* page dirtyings since bootup */ NR_WRITTEN, /* page writings since bootup */ + NR_METADATA_DIRTY_BYTES, /* Metadata dirty bytes */ + NR_METADATA_WRITEBACK_BYTES, /* Metadata writeback bytes */ + NR_METADATA_BYTES, /* total metadata bytes in use. */ NR_VM_NODE_STAT_ITEMS }; diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 2ccd9cc..f97c8de 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h @@ -390,6 +390,8 @@ TRACE_EVENT(writeback_queue_io, ) ); +#define BtoP(x) ((x) >> PAGE_SHIFT) + TRACE_EVENT(global_dirty_state, TP_PROTO(unsigned long background_thresh, @@ -402,7 +404,9 @@ TRACE_EVENT(global_dirty_state, TP_STRUCT__entry( __field(unsigned long, nr_dirty) + __field(unsigned long, nr_metadata_dirty) __field(unsigned long, nr_writeback) + __field(unsigned long, nr_metadata_writeback) __field(unsigned long, nr_unstable) __field(unsigned long, background_thresh) __field(unsigned long, dirty_thresh) @@ -413,7 +417,9 @@ TRACE_EVENT(global_dirty_state, TP_fast_assign( __entry->nr_dirty = global_node_page_state(NR_FILE_DIRTY); + __entry->nr_metadata_dirty = BtoP(global_node_page_state(NR_METADATA_DIRTY_BYTES)); __entry->nr_writeback = global_node_page_state(NR_WRITEBACK); + __entry->nr_metadata_dirty = BtoP(global_node_page_state(NR_METADATA_WRITEBACK_BYTES)); __entry->nr_unstable = global_node_page_state(NR_UNSTABLE_NFS); __entry->nr_dirtied = global_node_page_state(NR_DIRTIED); __entry->nr_written = global_node_page_state(NR_WRITTEN); @@ -424,7 +430,8 @@ TRACE_EVENT(global_dirty_state, TP_printk("dirty=%lu writeback=%lu unstable=%lu " "bg_thresh=%lu thresh=%lu limit=%lu " - "dirtied=%lu written=%lu", + "dirtied=%lu written=%lu metadata_dirty=%lu " + "metadata_writeback=%lu", __entry->nr_dirty, __entry->nr_writeback, __entry->nr_unstable, @@ -432,7 +439,9 @@ TRACE_EVENT(global_dirty_state, __entry->dirty_thresh, __entry->dirty_limit, __entry->nr_dirtied, - __entry->nr_written + __entry->nr_written, + __entry->nr_metadata_dirty, + __entry->nr_metadata_writeback ) ); diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 433db42..da3f68b 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -79,6 +79,8 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) "BackgroundThresh: %10lu kB\n" "BdiDirtiedBytes: %10lu kB\n" "BdiWrittenBytes: %10lu kB\n" + "BdiMetadataDirty: %10lu kB\n" + "BdiMetaWriteback: %10lu kB\n" "BdiWriteBandwidth: %10lu kBps\n" "b_dirty: %10lu\n" "b_io: %10lu\n" @@ -93,6 +95,8 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) K(background_thresh), (unsigned long) BtoK(wb_stat(wb, WB_DIRTIED_BYTES)), (unsigned long) BtoK(wb_stat(wb, WB_WRITTEN_BYTES)), + (unsigned long) BtoK(wb_stat(wb, WB_METADATA_DIRTY_BYTES)), + (unsigned long) BtoK(wb_stat(wb, WB_METADATA_WRITEBACK_BYTES)), (unsigned long) K(wb->write_bandwidth), nr_dirty, nr_io, diff --git a/mm/page-writeback.c b/mm/page-writeback.c index e09b3ad..48faf1b 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -296,6 +296,7 @@ static unsigned long node_dirtyable_memory(struct pglist_data *pgdat) nr_pages += node_page_state(pgdat, NR_INACTIVE_FILE); nr_pages += node_page_state(pgdat, NR_ACTIVE_FILE); + nr_pages += node_page_state(pgdat, NR_METADATA_BYTES) >> PAGE_SHIFT; return nr_pages; } @@ -372,6 +373,7 @@ static unsigned long global_dirtyable_memory(void) x += global_node_page_state(NR_INACTIVE_FILE); x += global_node_page_state(NR_ACTIVE_FILE); + x += global_node_page_state(NR_METADATA_BYTES) >> PAGE_SHIFT; if (!vm_highmem_is_dirtyable) x -= highmem_dirtyable_memory(x); @@ -380,6 +382,30 @@ static unsigned long global_dirtyable_memory(void) } /** + * global_dirty_memory - the number of globally dirty pages + * + * Returns the global number of pages that are dirty in pagecache and metadata. + */ +static unsigned long global_dirty_memory(void) +{ + return global_node_page_state(NR_FILE_DIRTY) + + global_node_page_state(NR_UNSTABLE_NFS) + + (global_node_page_state(NR_METADATA_DIRTY_BYTES) >> PAGE_SHIFT); +} + +/** + * global_writeback_memory - the number of pages under writeback globally + * + * Returns the global number of pages under writeback both in pagecache and in + * metadata. + */ +static unsigned long global_writeback_memory(void) +{ + return global_node_page_state(NR_WRITEBACK) + + (global_node_page_state(NR_METADATA_WRITEBACK_BYTES) >> PAGE_SHIFT); +} + +/** * domain_dirty_limits - calculate thresh and bg_thresh for a wb_domain * @dtc: dirty_throttle_control of interest * @@ -1514,7 +1540,7 @@ static long wb_min_pause(struct bdi_writeback *wb, static inline void wb_dirty_limits(struct dirty_throttle_control *dtc) { struct bdi_writeback *wb = dtc->wb; - unsigned long wb_reclaimable; + unsigned long wb_reclaimable, wb_writeback; /* * wb_thresh is not treated as some limiting factor as @@ -1544,12 +1570,17 @@ static inline void wb_dirty_limits(struct dirty_throttle_control *dtc) * deltas. */ if (dtc->wb_thresh < 2 * wb_stat_error(wb)) { - wb_reclaimable = wb_stat_sum(wb, WB_RECLAIMABLE); - dtc->wb_dirty = wb_reclaimable + wb_stat_sum(wb, WB_WRITEBACK); + wb_reclaimable = wb_stat_sum(wb, WB_RECLAIMABLE) + + (wb_stat_sum(wb, WB_METADATA_DIRTY_BYTES) >> PAGE_SHIFT); + wb_writeback = wb_stat_sum(wb, WB_WRITEBACK) + + (wb_stat_sum(wb, WB_METADATA_WRITEBACK_BYTES) >> PAGE_SHIFT); } else { - wb_reclaimable = wb_stat(wb, WB_RECLAIMABLE); - dtc->wb_dirty = wb_reclaimable + wb_stat(wb, WB_WRITEBACK); + wb_reclaimable = wb_stat(wb, WB_RECLAIMABLE) + + (wb_stat(wb, WB_METADATA_DIRTY_BYTES) >> PAGE_SHIFT); + wb_writeback = wb_stat(wb, WB_WRITEBACK) + + (wb_stat(wb, WB_METADATA_WRITEBACK_BYTES) >> PAGE_SHIFT); } + dtc->wb_dirty = wb_reclaimable + wb_writeback; } /* @@ -1594,10 +1625,9 @@ static void balance_dirty_pages(struct bdi_writeback *wb, * written to the server's write cache, but has not yet * been flushed to permanent storage. */ - nr_reclaimable = global_node_page_state(NR_FILE_DIRTY) + - global_node_page_state(NR_UNSTABLE_NFS); + nr_reclaimable = global_dirty_memory(); gdtc->avail = global_dirtyable_memory(); - gdtc->dirty = nr_reclaimable + global_node_page_state(NR_WRITEBACK); + gdtc->dirty = nr_reclaimable + global_writeback_memory(); domain_dirty_limits(gdtc); @@ -1928,20 +1958,22 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) struct dirty_throttle_control * const gdtc = &gdtc_stor; struct dirty_throttle_control * const mdtc = mdtc_valid(&mdtc_stor) ? &mdtc_stor : NULL; + unsigned long wb_reclaimable; /* * Similar to balance_dirty_pages() but ignores pages being written * as we're trying to decide whether to put more under writeback. */ gdtc->avail = global_dirtyable_memory(); - gdtc->dirty = global_node_page_state(NR_FILE_DIRTY) + - global_node_page_state(NR_UNSTABLE_NFS); + gdtc->dirty = global_dirty_memory(); domain_dirty_limits(gdtc); if (gdtc->dirty > gdtc->bg_thresh) return true; - if (wb_stat(wb, WB_RECLAIMABLE) > + wb_reclaimable = wb_stat(wb, WB_RECLAIMABLE) + + (wb_stat(wb, WB_METADATA_DIRTY_BYTES) >> PAGE_SHIFT); + if (wb_reclaimable > wb_calc_thresh(gdtc->wb, gdtc->bg_thresh)) return true; @@ -1956,7 +1988,7 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) if (mdtc->dirty > mdtc->bg_thresh) return true; - if (wb_stat(wb, WB_RECLAIMABLE) > + if (wb_reclaimable > wb_calc_thresh(mdtc->wb, mdtc->bg_thresh)) return true; } @@ -1980,8 +2012,8 @@ void throttle_vm_writeout(gfp_t gfp_mask) dirty_thresh += dirty_thresh / 10; /* wheeee... */ if (global_node_page_state(NR_UNSTABLE_NFS) + - global_node_page_state(NR_WRITEBACK) <= dirty_thresh) - break; + global_writeback_memory() <= dirty_thresh) + break; congestion_wait(BLK_RW_ASYNC, HZ/10); /* @@ -2008,8 +2040,7 @@ int dirty_writeback_centisecs_handler(struct ctl_table *table, int write, void laptop_mode_timer_fn(unsigned long data) { struct request_queue *q = (struct request_queue *)data; - int nr_pages = global_node_page_state(NR_FILE_DIRTY) + - global_node_page_state(NR_UNSTABLE_NFS); + int nr_pages = global_dirty_memory(); struct bdi_writeback *wb; /* @@ -2473,6 +2504,100 @@ void account_page_dirtied(struct page *page, struct address_space *mapping) EXPORT_SYMBOL(account_page_dirtied); /* + * account_metadata_dirtied + * @page - the page being dirited + * @bdi - the bdi that owns this page + * @bytes - the number of bytes being dirtied + * + * Do the dirty page accounting for metadata pages that aren't backed by an + * address_space. + */ +void account_metadata_dirtied(struct page *page, struct backing_dev_info *bdi, + long bytes) +{ + unsigned long flags; + + local_irq_save(flags); + __mod_node_page_state(page_pgdat(page), NR_METADATA_DIRTY_BYTES, + bytes); + __add_wb_stat(&bdi->wb, WB_DIRTIED_BYTES, bytes); + __add_wb_stat(&bdi->wb, WB_METADATA_DIRTY_BYTES, bytes); + current->nr_dirtied++; + task_io_account_write(bytes); + this_cpu_inc(bdp_ratelimits); + local_irq_restore(flags); +} +EXPORT_SYMBOL(account_metadata_dirtied); + +/* + * account_metadata_cleaned + * @page - the page being cleaned + * @bdi - the bdi that owns this page + * @bytes - the number of bytes cleaned + * + * Called on a no longer dirty metadata page. + */ +void account_metadata_cleaned(struct page *page, struct backing_dev_info *bdi, + long bytes) +{ + unsigned long flags; + + local_irq_save(flags); + __mod_node_page_state(page_pgdat(page), NR_METADATA_DIRTY_BYTES, + -bytes); + __add_wb_stat(&bdi->wb, WB_METADATA_DIRTY_BYTES, -bytes); + task_io_account_cancelled_write(bytes); + local_irq_restore(flags); +} +EXPORT_SYMBOL(account_metadata_cleaned); + +/* + * account_metadata_writeback + * @page - the page being marked as writeback + * @bdi - the bdi that owns this page + * @bytes - the number of bytes we are submitting for writeback + * + * Called on a metadata page that has been marked writeback. + */ +void account_metadata_writeback(struct page *page, + struct backing_dev_info *bdi, long bytes) +{ + unsigned long flags; + + local_irq_save(flags); + __add_wb_stat(&bdi->wb, WB_METADATA_DIRTY_BYTES, -bytes); + __mod_node_page_state(page_pgdat(page), NR_METADATA_DIRTY_BYTES, + -bytes); + __add_wb_stat(&bdi->wb, WB_METADATA_WRITEBACK_BYTES, bytes); + __mod_node_page_state(page_pgdat(page), NR_METADATA_WRITEBACK_BYTES, + bytes); + local_irq_restore(flags); +} +EXPORT_SYMBOL(account_metadata_writeback); + +/* + * account_metadata_end_writeback + * @page - the page we are ending writeback on + * @bdi - the bdi that owns this page + * @bytes - the number of bytes that just ended writeback + * + * Called on a metadata page that has completed writeback. + */ +void account_metadata_end_writeback(struct page *page, + struct backing_dev_info *bdi, long bytes) +{ + unsigned long flags; + + local_irq_save(flags); + __add_wb_stat(&bdi->wb, WB_METADATA_WRITEBACK_BYTES, -bytes); + __mod_node_page_state(page_pgdat(page), NR_METADATA_WRITEBACK_BYTES, + -bytes); + __wb_writeout_inc(&bdi->wb, bytes); + local_irq_restore(flags); +} +EXPORT_SYMBOL(account_metadata_end_writeback); + +/* * Helper function for deaccounting dirty page without writeback. * * Caller must hold lock_page_memcg(). diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a2214c6..b8c9d93 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4113,6 +4113,8 @@ out: } #define K(x) ((x) << (PAGE_SHIFT-10)) +#define BtoK(x) ((x) >> 10) +#define BtoP(x) ((x) >> PAGE_SHIFT) static void show_migration_types(unsigned char type) { @@ -4167,10 +4169,11 @@ void show_free_areas(unsigned int filter) printk("active_anon:%lu inactive_anon:%lu isolated_anon:%lu\n" " active_file:%lu inactive_file:%lu isolated_file:%lu\n" - " unevictable:%lu dirty:%lu writeback:%lu unstable:%lu\n" - " slab_reclaimable:%lu slab_unreclaimable:%lu\n" - " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n" - " free:%lu free_pcp:%lu free_cma:%lu\n", + " unevictable:%lu metadata:%lu dirty:%lu metadata_dirty:%lu\n" + " writeback:%lu unstable:%lu metadata_writeback:%lu\n" + " slab_reclaimable:%lu slab_unreclaimable:%lu mapped:%lu\n" + " shmem:%lu pagetables:%lu bounce:%lu free:%lu free_pcp:%lu\n" + " free_cma:%lu\n", global_node_page_state(NR_ACTIVE_ANON), global_node_page_state(NR_INACTIVE_ANON), global_node_page_state(NR_ISOLATED_ANON), @@ -4178,9 +4181,12 @@ void show_free_areas(unsigned int filter) global_node_page_state(NR_INACTIVE_FILE), global_node_page_state(NR_ISOLATED_FILE), global_node_page_state(NR_UNEVICTABLE), + BtoP(global_node_page_state(NR_METADATA_BYTES)), global_node_page_state(NR_FILE_DIRTY), + BtoP(global_node_page_state(NR_METADATA_DIRTY_BYTES)), global_node_page_state(NR_WRITEBACK), global_node_page_state(NR_UNSTABLE_NFS), + BtoP(global_node_page_state(NR_METADATA_WRITEBACK_BYTES)), global_page_state(NR_SLAB_RECLAIMABLE), global_page_state(NR_SLAB_UNRECLAIMABLE), global_node_page_state(NR_FILE_MAPPED), @@ -4200,9 +4206,12 @@ void show_free_areas(unsigned int filter) " unevictable:%lukB" " isolated(anon):%lukB" " isolated(file):%lukB" + " metadata:%lukB" " mapped:%lukB" " dirty:%lukB" + " metadata_dirty:%lukB" " writeback:%lukB" + " metadata_writeback:%lukB" " shmem:%lukB" #ifdef CONFIG_TRANSPARENT_HUGEPAGE " shmem_thp: %lukB" @@ -4222,9 +4231,12 @@ void show_free_areas(unsigned int filter) K(node_page_state(pgdat, NR_UNEVICTABLE)), K(node_page_state(pgdat, NR_ISOLATED_ANON)), K(node_page_state(pgdat, NR_ISOLATED_FILE)), + BtoK(node_page_state(pgdat, NR_METADATA_BYTES)), K(node_page_state(pgdat, NR_FILE_MAPPED)), K(node_page_state(pgdat, NR_FILE_DIRTY)), + BtoK(node_page_state(pgdat, NR_METADATA_DIRTY_BYTES)), K(node_page_state(pgdat, NR_WRITEBACK)), + BtoK(node_page_state(pgdat, NR_METADATA_WRITEBACK_BYTES)), #ifdef CONFIG_TRANSPARENT_HUGEPAGE K(node_page_state(pgdat, NR_SHMEM_THPS) * HPAGE_PMD_NR), K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED) diff --git a/mm/util.c b/mm/util.c index 662cddf..e8b8b7f 100644 --- a/mm/util.c +++ b/mm/util.c @@ -548,6 +548,8 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) */ free += global_page_state(NR_SLAB_RECLAIMABLE); + free += global_page_state(NR_METADATA_BYTES) >> PAGE_SHIFT; + /* * Leave reserved pages. The pages are not for anonymous pages. */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 0fe8b71..322d6d4 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -218,7 +218,8 @@ unsigned long pgdat_reclaimable_pages(struct pglist_data *pgdat) nr = node_page_state_snapshot(pgdat, NR_ACTIVE_FILE) + node_page_state_snapshot(pgdat, NR_INACTIVE_FILE) + - node_page_state_snapshot(pgdat, NR_ISOLATED_FILE); + node_page_state_snapshot(pgdat, NR_ISOLATED_FILE) + + (node_page_state_snapshot(pgdat, NR_METADATA_BYTES) >> PAGE_SHIFT); if (get_nr_swap_pages() > 0) nr += node_page_state_snapshot(pgdat, NR_ACTIVE_ANON) + @@ -3680,6 +3681,7 @@ static inline unsigned long node_unmapped_file_pages(struct pglist_data *pgdat) static unsigned long node_pagecache_reclaimable(struct pglist_data *pgdat) { unsigned long nr_pagecache_reclaimable; + unsigned long nr_metadata_reclaimable; unsigned long delta = 0; /* @@ -3701,7 +3703,20 @@ static unsigned long node_pagecache_reclaimable(struct pglist_data *pgdat) if (unlikely(delta > nr_pagecache_reclaimable)) delta = nr_pagecache_reclaimable; - return nr_pagecache_reclaimable - delta; + nr_metadata_reclaimable = + node_page_state(pgdat, NR_METADATA_BYTES) >> PAGE_SHIFT; + /* + * We don't do writeout through the shrinkers so subtract any + * dirty/writeback metadata bytes from the reclaimable count. + */ + if (nr_metadata_reclaimable) { + unsigned long unreclaimable = + node_page_state(pgdat, NR_METADATA_DIRTY_BYTES) + + node_page_state(pgdat, NR_METADATA_WRITEBACK_BYTES); + unreclaimable >>= PAGE_SHIFT; + nr_metadata_reclaimable -= unreclaimable; + } + return nr_metadata_reclaimable + nr_pagecache_reclaimable - delta; } /* diff --git a/mm/vmstat.c b/mm/vmstat.c index 89cec42..b762e39 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -973,6 +973,9 @@ const char * const vmstat_text[] = { "nr_vmscan_immediate_reclaim", "nr_dirtied", "nr_written", + "nr_metadata_dirty_bytes", + "nr_metadata_writeback_bytes", + "nr_metadata_bytes", /* enum writeback_stat_item counters */ "nr_dirty_threshold",