Comment 12 for bug 1319244

Revision history for this message
Stefan Bader (smb) wrote :

It turns out we (you) were not the first ones running into it. The IBM mainframe guys (obviously) have the same need to potentially allow many CPUs. The upstream discussion is here: https://lkml.org/lkml/2014/5/21/251

So, while the change I made does work in this case, it can cause issues. Firstly /proc/stat uses a open_single interface. That means the proc file is not seekable and has no iterator. So all output has to be done in one go. And that means the buffer _has_ to be big enough to hold all output. Which means the part that limits the maximum size to order-3 allocations can cause issue on systems that really have a lot of CPUs.
The other part of changing the buffer from holding x*possible number of CPUs to x*online CPUs was also thought of in the upstream thread. The problem there is that between open (buffer gets allocated) and show (buffer is filled) it is possible than a bunch of CPUs are set online. So one needs to be extra careful what would happen then.

Sounds like the most likely outcome could be to have a vmalloc fallback option. But the discussion does not seem to be finished, yet.