Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp519871rwi; Thu, 20 Oct 2022 01:36:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4lsN633KymE2MQH7h+XWqrtD88xrcpmSAqYKN/wZZc9430oE7V+co3GwxfAxMyauwSILIW X-Received: by 2002:a05:6402:5ca:b0:445:c80a:3c2 with SMTP id n10-20020a05640205ca00b00445c80a03c2mr11175632edx.247.1666255003101; Thu, 20 Oct 2022 01:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666255003; cv=none; d=google.com; s=arc-20160816; b=wY/TfBZE41Z2r5mMF6OiTcP8MJol448vUAlqfZ1upfOTGu6h0P+cnX3NbWE8lZFxsN nNEujbd+EbB/De7t0SP+Ar5c7eKdjbgFSqSsd31EQ5EZtlCTFaXF6gDH4X8Y/drkar53 vG+VKN8Ts8Rsb/gQ6Z1sEiAkbQ+MYGaYJK9+HhtuQu+UfBXdvMs/v9UNcksUmfGTrcVe ucydVVrMVUNJF57Oc7p4eSra/uohrihMCMsk6vuxX/xBrN/IXxJyVrl7SeDfsCMt26wj z9Rk4DUJ+482Cc8FiBR3zL3TQubuTlLQitvW6mi1tr3T3vWG44cppdDc9PHrU8HbXtpf kWUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YBJ6CPVckSe7+zKCUltneL6fxHtUazOx75/bK3nYf7g=; b=itu0kYRmwaRY94deX42wB8EZ+Rvu42Peioeao0cFNUk6nzH3yuzhgzPqFo/0/zZXKe M8nDVa7VO2n8FWHiT7f4jJTYDjgCQ7GChc1VdFvtpVHXOzIthDHwwGRr2GJSL4801tTB F4ye4uYlT71PQAso0U48TfWThSEINkR+NrfxE7Yg8oq6iIsjHOpTS14JRm9u8oG8Yie2 lGZpu4VoyAT59+V5TnrajS6C+McxgPkos11LTmpI1b2QjIqxL7P+LZgqS1IrA7X1uRXZ /m4/CyFZJ6nJ+k8QMMN6Zf0tBtbxOSVzT+l2bZZp6+yHCyYq3Fwv4BHdsvleoI9iqia9 1z6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Pk760JUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a0564021e9100b00456e33b69e1si20743819edf.347.2022.10.20.01.36.16; Thu, 20 Oct 2022 01:36:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Pk760JUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbiJTIae (ORCPT + 99 others); Thu, 20 Oct 2022 04:30:34 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.