Reputation: 1007
We had a kernel module which writes into a file and we read the proc file to get some information regarding hardware operation. The hardware operation statistics data became more than 3072 bytes (PROC_BLOCK_SIZE) ; so we locally buffer the data by defining a global buffer of size 4096 bytes . Once the data is completely read then we move the data to the proc_read_kernel buffer to the local buffer. This is done as per hack (2) defined around line number 165 in linux-2.6.28/proc/fs/generic.c. We are not sending eof till the entire buffer is read so read proc will be called two times one for 3072 bytes and next for 1024 bytes. We do a memcpy to copy the data to the read proc buffer. The read proc will be invoked only by command line.
But inserting this particular module after adding the global buffer is making some difference in the performance numbers of get from storage device . If we do not do modprobe of this kernel module then we are seeing better numbers. Logically the global buffer will be in BSS area and since the command is not called so memcpy will also not be invoked. We are not able to explain this anomaly. Any pointers will be highly helpful.
Upvotes: 0
Views: 338
Reputation: 231461
My crystal ball is out at the cleaners today, so I'm afraid I can't quite divine what kind of 'hack' you've done and whether it might impact something, much less where the real problem might be.
That said, I would recommend you start eliminating possible sources of problems. Remove parts of your module and load it, and see if you still see a performance degradation. Kill your hack (get your stats via a character device or something!) and see if that helps. Heck, load a dummy 'hello world!' module and see if that does something. Once you've narrowed down the cause a bit come back again and maybe someone will be able to help you - with no code to go on, and no idea what changes you've made, it's just impossible to give you any more specific answers.
Upvotes: 3