android_kernel_sony_sdm845/include
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Davidlohr Bueso c89a768024 rbtree: cache leftmost node internally
commit cd9e61ed1eebbcd5dfad59475d41ec58d9b64b6a upstream.

Patch series "rbtree: Cache leftmost node internally", v4.

A series to extending rbtrees to internally cache the leftmost node such
that we can have fast overlap check optimization for all interval tree
users[1].  The benefits of this series are that:

(i)   Unify users that do internal leftmost node caching.
(ii)  Optimize all interval tree users.
(iii) Convert at least two new users (epoll and procfs) to the new interface.

This patch (of 16):

Red-black tree semantics imply that nodes with smaller or greater (or
equal for duplicates) keys always be to the left and right,
respectively.  For the kernel this is extremely evident when considering
our rb_first() semantics.  Enabling lookups for the smallest node in the
tree in O(1) can save a good chunk of cycles in not having to walk down
the tree each time.  To this end there are a few core users that
explicitly do this, such as the scheduler and rtmutexes.  There is also
the desire for interval trees to have this optimization allowing faster
overlap checking.

This patch introduces a new 'struct rb_root_cached' which is just the
root with a cached pointer to the leftmost node.  The reason why the
regular rb_root was not extended instead of adding a new structure was
that this allows the user to have the choice between memory footprint
and actual tree performance.  The new wrappers on top of the regular
rb_root calls are:

 - rb_first_cached(cached_root) -- which is a fast replacement
     for rb_first.

 - rb_insert_color_cached(node, cached_root, new)

 - rb_erase_cached(node, cached_root)

In addition, augmented cached interfaces are also added for basic
insertion and deletion operations; which becomes important for the
interval tree changes.

With the exception of the inserts, which adds a bool for updating the
new leftmost, the interfaces are kept the same.  To this end, porting rb
users to the cached version becomes really trivial, and keeping current
rbtree semantics for users that don't care about the optimization
requires zero overhead.

Link: http://lkml.kernel.org/r/20170719014603.19029-2-dave@stgolabs.net
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-27 08:47:42 +01:00
..
acpi ACPI: scan: Use unique number for instance_no 2021-03-30 14:41:41 +02:00
asm-generic hugetlbfs: flush TLBs correctly after huge_pmd_unshare 2021-12-08 08:45:03 +01:00
clocksource
crypto crypto: public_key: fix overflow during implicit conversion 2021-09-22 11:43:03 +02:00
drm drm: mst: Fix query_payload ack reply struct 2020-01-04 13:39:00 +01:00
dt-bindings dt-bindings: reset: meson8b: fix duplicate reset IDs 2020-01-23 08:19:38 +01:00
keys KEYS: user: Align the payload buffer 2019-02-27 10:07:00 +01:00
kvm arm/arm64: KVM: Add PSCI version selection API 2018-05-09 09:50:19 +02:00
linux rbtree: cache leftmost node internally 2022-01-27 08:47:42 +01:00
math-emu math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning 2019-12-21 10:41:02 +01:00
media media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros 2020-02-28 15:42:24 +01:00
memory
misc
net net_sched: restore "mpu xxx" handling 2022-01-27 08:47:42 +01:00
pcmcia
ras
rdma IB/cma: Fix reference count leak when no ipv4 addresses are set 2020-06-03 08:16:33 +02:00
rxrpc
scsi scsi: iscsi: Add iscsi_cls_conn refcount helpers 2021-07-20 16:21:11 +02:00
soc irqchip/eznps: Fix build error for !ARC700 builds 2020-09-23 08:46:10 +02:00
sound ALSA: compress: fix partial_drain completion state 2020-07-22 09:10:45 +02:00
target scsi: target: Fix ordered tag handling 2021-11-26 11:48:41 +01:00
trace memcg: fix a crash in wb_workfn when a device disappears 2021-02-23 13:59:15 +01:00
uapi uapi: fix linux/nfc.h userspace compilation errors 2022-01-05 12:31:25 +01:00
video udlfb: set optimal write delay 2018-09-09 20:01:25 +02:00
xen xen: sync include/xen/interface/io/ring.h with Xen's newest version 2021-12-08 08:45:04 +01:00
Kbuild