From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1CC7C433FE for ; Thu, 20 Oct 2022 08:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229747AbiJTIac (ORCPT ); Thu, 20 Oct 2022 04:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbiJTIab (ORCPT ); Thu, 20 Oct 2022 04:30:31 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27FF4BC450; Thu, 20 Oct 2022 01:30:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=YBJ6CPVckSe7+zKCUltneL6fxHtUazOx75/bK3nYf7g=; b=Pk760JUMtwMM6mZkn5N3uYVLBe BnSlExu/eaLRfYWmr9ml2dGZNx7DeXSDdL3f/0je0r+c06j/wS7AG2tzoqV0/0k10QvbzmNscp00A uTm7+ZkzYpnHxrC7y0J/oVMTMtSaMIeUmWzT/dKZBpHnV/dNXCCcomyJO5Muv0cf46s7I5LL5i9Cx vTjzVhBzZvCcI3MGxOooui2FGpbKLpPNuw7ox3raU3wTa62QOvXCtPNI/uu28fvEPNRH2uDRXNW2I xPFjUlx9W+94lYKKZwgOe1avQF3mjOICW0k2QAOl1XVc7cZlGFq7xiYTmpqVf9SGNXPiRpe3sPy3j rtGQw+ZA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1olQwZ-00CDV4-3I; Thu, 20 Oct 2022 08:30:23 +0000 Date: Thu, 20 Oct 2022 01:30:23 -0700 From: Christoph Hellwig To: Pavel Begunkov Cc: Jens Axboe , linux-block@vger.kernel.org, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC for-next v2 2/4] bio: split pcpu cache part of bio_put into a helper Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: io-uring@vger.kernel.org > + if ((bio->bi_opf & REQ_POLLED) && !WARN_ON_ONCE(in_interrupt())) { > + bio->bi_next = cache->free_list; > + cache->free_list = bio; > + cache->nr++; > + } else { > + put_cpu(); > + bio_free(bio); > + return; > + } This reads a little strange with the return in an else. Why not: if (!(bio->bi_opf & REQ_POLLED) || WARN_ON_ONCE(in_interrupt())) { put_cpu(); bio_free(bio); return; } bio->bi_next = cache->free_list; cache->free_list = bio; cache->nr++; but given that the simple free case doesn't care about what CPU we're on or the per-cpu cache pointer, I think we can simply move the cache = per_cpu_ptr(bio->bi_pool->cache, get_cpu()); after the above return as well.