From: Christoph Hellwig Date: Tue, 12 Oct 2021 11:12:22 +0000 (+0200) Subject: block: use SLAB_TYPESAFE_BY_RCU for the bio slab X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1a7e76e4f130332b5d3b0c72c4f664e59deb1239;p=uclinux-h8%2Flinux.git block: use SLAB_TYPESAFE_BY_RCU for the bio slab This flags ensures that the pages will not be reused for non-bio allocations before the end of an RCU grace period. With that we can safely use a RCU lookup for bio polling as long as we are fine with occasionally polling the wrong device. Signed-off-by: Christoph Hellwig Tested-by: Mark Wunderlich Link: https://lore.kernel.org/r/20211012111226.760968-13-hch@lst.de Signed-off-by: Jens Axboe --- diff --git a/block/bio.c b/block/bio.c index d5120451c36a..df45f4b996ac 100644 --- a/block/bio.c +++ b/block/bio.c @@ -87,7 +87,8 @@ static struct bio_slab *create_bio_slab(unsigned int size) snprintf(bslab->name, sizeof(bslab->name), "bio-%d", size); bslab->slab = kmem_cache_create(bslab->name, size, - ARCH_KMALLOC_MINALIGN, SLAB_HWCACHE_ALIGN, NULL); + ARCH_KMALLOC_MINALIGN, + SLAB_HWCACHE_ALIGN | SLAB_TYPESAFE_BY_RCU, NULL); if (!bslab->slab) goto fail_alloc_slab;