staging: erofs: <linux/tagptr.h>: introduce tagged pointer
authorGao Xiang <gaoxiang25@huawei.com>
Thu, 26 Jul 2018 12:21:56 +0000 (20:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jul 2018 15:24:08 +0000 (17:24 +0200)
commitb8b58b3280b376d55f4e90f8d28904deb2dc1d5c
tree86267ffc478f6d8f4b9dfc55a83785b5f352d90f
parent13f06f48f7bf8ebfa443e9496d382fa3d20b9ff3
staging: erofs: <linux/tagptr.h>: introduce tagged pointer

Currently kernel has scattered tagged pointer usages hacked
by hand in plain code, without a unique and portable functionset
to highlight the tagged pointer itself and wrap these hacked code
in order to clean up all over meaningless magic masks.

Therefore, this patch introduces simple generic methods to fold
tags into a pointer integer. It currently supports the last n bits
of the pointer for tags, which can be selected by users.

In addition, it will also be used for the upcoming EROFS filesystem,
which heavily uses tagged pointer approach for high performance
and reducing extra memory allocation.

Link: https://en.wikipedia.org/wiki/Tagged_pointer
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/erofs/include/linux/tagptr.h [new file with mode: 0644]