summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi RongQing <lirongqing@baidu.com>2025-04-10 19:21:17 +0800
committerChristian Brauner <brauner@kernel.org>2025-04-21 10:27:58 +0200
commitef181fa11d9e09d3741525937d7bab4c5ab91ef7 (patch)
tree31f9e5b5c5b3d406365cea8a64ca48089b38db1c
parent6b24a702ecf167ab61456276bb72133d84ccca45 (diff)
downloadlinux-ef181fa11d9e09d3741525937d7bab4c5ab91ef7.tar.gz
linux-ef181fa11d9e09d3741525937d7bab4c5ab91ef7.tar.bz2
linux-ef181fa11d9e09d3741525937d7bab4c5ab91ef7.zip
fs: Make file-nr output the total allocated file handles
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@baidu.com> Link: https://lore.kernel.org/20250410112117.2851-1-lirongqing@baidu.com Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r--fs/file_table.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index c04ed94cdc4b..138114d64307 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);
}