]> git.baikalelectronics.ru Git - kernel.git/commit
percpu_ref: reduce memory footprint of percpu_ref in fast path
authorMing Lei <ming.lei@redhat.com>
Thu, 1 Oct 2020 15:48:41 +0000 (23:48 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 6 Oct 2020 13:29:36 +0000 (07:29 -0600)
commite1c6bb62949c2edae29cf9f834a309a167999fe7
tree1ffab7ee6f2455b56c8128379ab032e06df8cf8e
parent8244d13c67fbb55c74591948274f2d54751c64dc
percpu_ref: reduce memory footprint of percpu_ref in fast path

'struct percpu_ref' is often embedded into one user structure, and the
instance is usually referenced in fast path, however actually only
'percpu_count_ptr' is needed in fast path.

So move other fields into one new structure of 'percpu_ref_data', and
allocate it dynamically via kzalloc(), then memory footprint of
'percpu_ref' in fast path is reduced a lot and becomes suitable to put
into hot cacheline of user structure.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Veronika Kabatova <vkabatov@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/infiniband/sw/rdmavt/mr.c
include/linux/percpu-refcount.h
lib/percpu-refcount.c