From patchwork Tue Apr 27 16:16:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12226927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0ED3C43460 for ; Tue, 27 Apr 2021 16:20:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71C6F61186 for ; Tue, 27 Apr 2021 16:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237893AbhD0QVa (ORCPT ); Tue, 27 Apr 2021 12:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236397AbhD0QTy (ORCPT ); Tue, 27 Apr 2021 12:19:54 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D38AC061342; Tue, 27 Apr 2021 09:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=QPTpS5s0fUYR+1QqobLHklvCGfS9dVC8BfnJQZtbCQk=; b=ul+0VdZVYoXar6xgqAY9m0LEQw pRNEsz57RJCq+Vl8Ixk8+VCjkNgw9ARKTPYKnY065IDNuHwbQiJ9Hl/HLyo2X2OT15R73RdCtYfmh jwYBzCE6acziGGH8JZ2CjA3bWBpf/JkNIG3YCoAQYv4ToqaNwBUwcqHXkJUq7S1upZaQzSzW0Ofij RqDP96uEcn+igyPYXIJlhHHnvUUZzL1hbmBlvcyokuO8DCI6GlHamgaPwyHsIkH2verHUHtU+xTKi nQSuJi7CeNZ7w/UTfwi+QxHynuXAepB18bIIaufQUst/BlZccH5/AdyB5+GO4ouYi20+DFfJ1UDIS DIvlnetw==; Received: from [2001:4bb8:18c:28b2:c772:7205:2aa4:840d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lbQQR-00Gr5b-OL; Tue, 27 Apr 2021 16:19:04 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Jeffle Xu , Ming Lei , Damien Le Moal , Keith Busch , Sagi Grimberg , "Wunderlich, Mark" , "Vasudevan, Anil" , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 10/15] block: use SLAB_TYPESAFE_BY_RCU for the bio slab Date: Tue, 27 Apr 2021 18:16:14 +0200 Message-Id: <20210427161619.1294399-11-hch@lst.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210427161619.1294399-1-hch@lst.de> References: <20210427161619.1294399-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 --- block/bio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/bio.c b/block/bio.c index 44205dfb6b60..de5505d7018e 100644 --- a/block/bio.c +++ b/block/bio.c @@ -82,7 +82,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;