file-nr

Historically, the three values in file-nr denoted the number of allocated file handles, the number of allocated but unused file handles, and the maximum number of file handles. Linux 2.6 always reports 0 as the number of free file handles - this is not an error, it just means that the number of allocated file handles exactly matches the number of used file handles.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

What about the first field?

If this is really the number of open file handles, why doesn't if change if I open some files? If I open 100, it will increase but not by 100. Clearly some of these handles are being cached/reused, but if so is there no field that tells me the number open? Feels like it's of minimal use for anything other than to tell me if I'm running out of handles
-mark

I suppose you're right.

I suppose you're right. Probable reason why it doesn't increase linearly is that it uses SLAB allocator (or similar), which means that it allocates file structures in chunks, and also leaves some (unused) allocations lingering until some sort of garbage collection (typically memory pressure) collects the unused items. But, to be completely sure, we'd need to consult the kernel source.

I'd agree with you that those numbers are just for telling you when you're in serious trouble because some application is behaving badly and leaking open files. Who needs 200000 open files and for what reason? ;)