mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs: Make file-nr output the total allocated file handles
@ 2025-04-10 11:21 lirongqing
  2025-04-11 14:16 ` Christian Brauner
  2025-04-14 10:07 ` (subset) " Christian Brauner
  0 siblings, 2 replies; 6+ messages in thread
From: lirongqing @ 2025-04-10 11:21 UTC (permalink / raw)
  To: viro, brauner, jack, linux-fsdevel, linux-kernel; +Cc: Li RongQing

From: Li RongQing <lirongqing@baidu.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@baidu.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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-14 11:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-10 11:21 [PATCH] fs: Make file-nr output the total allocated file handles lirongqing
2025-04-11 14:16 ` Christian Brauner
2025-04-11 21:15   ` Mateusz Guzik
2025-04-12 12:59   ` 答复: [外部邮件] " Li,Rongqing
2025-04-14 10:07 ` (subset) " Christian Brauner
2025-04-14 11:05   ` 答复: [外部邮件] " Li,Rongqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®