[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250410112117.2851-1-lirongqing@baidu.com>
Date: Thu, 10 Apr 2025 19:21:17 +0800
From: lirongqing <lirongqing@...du.com>
To: <viro@...iv.linux.org.uk>, <brauner@...nel.org>, <jack@...e.cz>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: Li RongQing <lirongqing@...du.com>
Subject: [PATCH] fs: Make file-nr output the total allocated file handles
From: Li RongQing <lirongqing@...du.com>
Make file-nr output the total allocated file handles, not per-cpu
cache number, it's more precise, and not in hot path
Signed-off-by: Li RongQing <lirongqing@...du.com>
---
fs/file_table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/file_table.c b/fs/file_table.c
index c04ed94..138114d 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(get_max_files);
static int proc_nr_files(const struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos)
{
- files_stat.nr_files = get_nr_files();
+ files_stat.nr_files = percpu_counter_sum_positive(&nr_files);
return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
}
--
2.9.4
Powered by blists - more mailing lists