nr_inodes wrong patch - and how to?

nr_inodes wrong patch - and how to?

Post by didds » Fri, 10 Oct 2003 18:40:25

I am babysitting some clients systems uin between permy staff.

They run for historical/legacy/3rd party s/w reasons RH 7.3 - kernel

It has come to their attention that the value for nr_inodes in
/proc/sys/fs/inode-state is wrong due to a bug in all 2.4 smp kernels.
They have a diff file (by the look of it) that is a patch to
/usr/src/linux-2.4.18-3/fs/inode.c they would like applied.

Anyoe got a quick guide for dummies?

Presumably I apply this diff, and then recompile inode.c... but I
suspoect its a tad bigger than that! Any pointers?



1. [PATCH 03/19] fs: Convert nr_inodes and nr_unused to per-cpu counters

2. [PATCH 16/17] fs: Convert nr_inodes to a per-cpu counter

Le samedi 16 octobre 2010 18:55 +1100, Nick Piggin a crit :


Some people believe percpu_counter object is the right answer to such
distributed counters, because the loop is done on 'online' cpus instead
of 'possible' cpus. "It must be better if number of possible cpus is
4096 and only one or two cpus are online"...

But if we do this loop only on rare events, like
"cat /proc/sys/fs/inode-nr", then the percpu_counter() is more
expensive, because percpu_add() _is_ more expensive :

- Its a function call and lot of instructions/cycles per call, while
this_cpu_inc(nr_inodes) is a single instruction, using no register on

- Its possibly accessing a shared spinlock and counter when the percpu
counter reaches the batch limit.

To recap : nr_inodes is not a counter that needs to be estimated in real
time, since we have not limit on number of inodes in the machine (limit
is the memory allocator).

Unless someone can prove "cat /proc/sys/fs/inode-nr" must be performed
thousand of times per second on their setup, the choice I made to scale
nr_inodes is better over the 'obvious percpu_counter choice'

This choice was made to scale some counters in network stack some years
ago, and this rocks.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at
Please read the FAQ at

3. registry/patch experts: MFG's patch looking at wrong place in registry?

4. Specify list items with unlimited ANDs and ORs?

5. Multiple ANDs

6. Excel file expands ands locks Excel

7. Concatenating date field into text ands using in a formula

8. multiple ifs & ands indirect/offset...need help desperately please

9. if & ands and either indirect or offset - need help fast please

10. Sumproduct assistance - need multiple ANDs and ORs

11. WMP11 BUG: Advanced Search doesn't work with ANDs

12. Stenciling and multiple buffer "ands"

13. Anonymous hacker is wrong wrong wrong

14. 3 ANDS + 1 OR

15. Nesting ,Ands