summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-05-01 09:35:09 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-05-01 10:26:40 -0400
commit73a757e63114dfd765f1c5d1ff7e994f123d0234 (patch)
tree757adb3d5a56f4a22c8e98e106068fc6666d1969 /init
parentca2958f14c4706d5dced95f4f7dfe2bdd1b268de (diff)
downloadlinux-rpi-73a757e63114dfd765f1c5d1ff7e994f123d0234.tar.gz
linux-rpi-73a757e63114dfd765f1c5d1ff7e994f123d0234.tar.bz2
linux-rpi-73a757e63114dfd765f1c5d1ff7e994f123d0234.zip
ring-buffer: Return reader page back into existing ring buffer
When reading the ring buffer for consuming, it is optimized for splice, where a page is taken out of the ring buffer (zero copy) and sent to the reading consumer. When the read is finished with the page, it calls ring_buffer_free_read_page(), which simply frees the page. The next time the reader needs to get a page from the ring buffer, it must call ring_buffer_alloc_read_page() which allocates and initializes a reader page for the ring buffer to be swapped into the ring buffer for a new filled page for the reader. The problem is that there's no reason to actually free the page when it is passed back to the ring buffer. It can hold it off and reuse it for the next iteration. This completely removes the interaction with the page_alloc mechanism. Using the trace-cmd utility to record all events (causing trace-cmd to require reading lots of pages from the ring buffer, and calling ring_buffer_alloc/free_read_page() several times), and also assigning a stack trace trigger to the mm_page_alloc event, we can see how many times the ring_buffer_alloc_read_page() needed to allocate a page for the ring buffer. Before this change: # trace-cmd record -e all -e mem_page_alloc -R stacktrace sleep 1 # trace-cmd report |grep ring_buffer_alloc_read_page | wc -l 9968 After this change: # trace-cmd record -e all -e mem_page_alloc -R stacktrace sleep 1 # trace-cmd report |grep ring_buffer_alloc_read_page | wc -l 4 Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions