]> www.infradead.org Git - users/hch/block.git/commitdiff
block: use SLAB_TYPESAFE_BY_RCU for the bio slab
authorChristoph Hellwig <hch@lst.de>
Mon, 26 Apr 2021 16:17:31 +0000 (18:17 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 12 Oct 2021 10:41:16 +0000 (12:41 +0200)
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 <hch@lst.de>
Tested-by: Mark Wunderlich <mark.wunderlich@intel.com>
block/bio.c

index a6fb6a0b429550d0559924afac6cb7326b2669d2..a48cf9d04b3c1c57d39cc435d65f85b0074a40ad 100644 (file)
@@ -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;