]> git.baikalelectronics.ru Git - kernel.git/commit
ipc/mqueue: optimize msg_get()
authorDavidlohr Bueso <dave@stgolabs.net>
Tue, 14 May 2019 22:46:26 +0000 (15:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 15 May 2019 02:52:52 +0000 (19:52 -0700)
commit15cb95c939f5925bd33eefa8041ab508e2f9fb07
treece1b9afe61db8786cae4a5576e599d0f6d46d8e0
parentb19e5d9d2e5a95132560c126890e7513d777e535
ipc/mqueue: optimize msg_get()

Our msg priorities became an rbtree as of f98af1700f41 ("ipc/mqueue:
improve performance of send/recv").  However, consuming a msg in
msg_get() remains logarithmic (still being better than the case before
of course).  By applying well known techniques to cache pointers we can
have the node with the highest priority in O(1), which is specially nice
for the rt cases.  Furthermore, some callers can call msg_get() in a
loop.

A new msg_tree_erase() helper is also added to encapsulate the tree
removal and node_cache game.  Passes ltp mq testcases.

Link: http://lkml.kernel.org/r/20190321190216.1719-2-dave@stgolabs.net
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ipc/mqueue.c