Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2501376lqo; Mon, 20 May 2024 07:49:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXomrt90Rc17AT96+LOKyW18x1tWRfFX4vqJb8Wym/QZIWt4BVo0ljobq0LR1pQC/3gvtA15stMcYAu9/rnIWB8BN9tyDKHhq992tw1mA== X-Google-Smtp-Source: AGHT+IHP+9w8TVZSwWqx/DyGkMXG4EB0MVqnQQDreWnhKlIehBoRSnrH3zDF+NIrhTS+ar82Y0NS X-Received: by 2002:a17:902:e5d1:b0:1f3:675:a677 with SMTP id d9443c01a7336-1f30675a935mr16921285ad.20.1716216558356; Mon, 20 May 2024 07:49:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716216558; cv=pass; d=google.com; s=arc-20160816; b=H2DX3unxEErvnf6JWaFJbixyyd9fLZBp8IR9WcTwVzintR1XnF1vSb7R5dHYWJA+eB TCngTm/LSJngeqUXHufQgXosdhK8CVb3BnG6FkcNnOrexIkv+mlaMFxLzRU5tE5bQVxG e/j4BNe33qUuLh+cpo4dlUcPnXBB9+UoUN2+TnOaSP5VPC/Rvjnq3u13GRxc2w6cRaIk erHoTsdjAb3xRdv5NeUhqHTmO39hHPF0jW8Gt0Raq7rZgWQW+VcyxIeTKKgNxeZP98E4 3mtIBrgyMerdbW91KjmeRooE52YvjPIxGHPFW48r2Q//rhIgqNINDKeqEXWM8o/Iqg2J ZNpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ma3e4Sk24HsgLp3aQNAtEmUDt/dQYhZaJBsAeHEQZXc=; fh=2q4TACDe6TFYaUNcv5HEH7UqlQsqw3j92PpbZcsMfXU=; b=NWt7RLtTKTvNliL5GzDVaDv+DNDuUMSVVCeBu2pcPT1/xRhw64hxEkCbf8fS/oxI/g D6USdueNQLuxOqxXbcs+Fo0mw9cN3N7vS+uFRO6RYnMMa/Auq97QmMSW7ZyDr1ryTrOy tRkx4PHD19FCFFCO+tZd4BXGULbOoPfDfowDb1xEBtBAiG1Cqi6yb+Xf8UgWBZoDaUOd xJXd+zFq+S5y1LgnysPrpXcOdFViGhucETJpPvhnOjLIGQKOoHNF64fEOh7HSxy/XUZc wa+r3lTzpi+hTjxb+9CJq2/8U0X0w6LkocopSQXIb9j2y1DbvbSuZOBvPtaGgsEB1FPg O6Ag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ln+ZHaNM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-183856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c26a13dsi30658625ad.603.2024.05.20.07.49.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 07:49:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ln+ZHaNM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-183856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 57284B211CE for ; Mon, 20 May 2024 14:46:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68DB21369BC; Mon, 20 May 2024 14:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ln+ZHaNM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 830CF1E878; Mon, 20 May 2024 14:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716216385; cv=none; b=QKquuj1LqP0kJN3WpCCvJcox3cyKjkPwX54FGpfEzSUC0hueUa8uuyWGsw2a4yE1L7ztb7KxAOUhJI2P/T0XMsbmZIGtC+dcz5trIvj2d9rjvCNI/xWAFh6AdGkSuLpoXB9OtQcnhv6P1kRpq9J4IIzEEVHbs4eD7SUporZ1Pd0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716216385; c=relaxed/simple; bh=nkYor5RmQ81d94obxlBN808m0wZIacK6XzjCZHCe7dA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lW7suEhZpxF9LDpo8YwweInr3z/fiYT58CXO9xp46Z8RwBIykqezxxo+byi+ft6si+3X/xzIiLTIDPFWyEB7Wnnfj8+g3HP2wroEyTit4mSvk/gS+xZapAxnC+6Lb3d7rRqtOb6RSrezclmYlKMVoq1tuUXAQJd9dcCInV1dnPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ln+ZHaNM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB296C2BD10; Mon, 20 May 2024 14:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716216385; bh=nkYor5RmQ81d94obxlBN808m0wZIacK6XzjCZHCe7dA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ln+ZHaNMsU/xVjFM9yVnYQqEJs4vY0NyRs9vgq/yJ38mTZ1h5xU/kaXHx53DhUvQj Xl5S7TNuMUnnUUXWSxasIAQZ1kNfpwO96PM2KQMRQZcXePR5mcX0kKYX96g9A5/W9N VOaDejndqUsXMh7jJGZ7h37xN/qVr27q+51Ve3atVeP9yXcfcAbD4kaTxUF5D9lGKP 2KCdbCPzdMs5F4CLftTg4dF3Q79FWXC1H9sVe/+zSvWWSRZMtI08EejIpozzX1L/Eh Z2f6FIZC8Jedd494JII5VVOqE/qVPmoczTM+UHwgqD9z6jnsPPohWieqtq4wLSc04q N/QXL1Von0s+w== Date: Mon, 20 May 2024 08:46:21 -0600 From: Keith Busch To: John Meneghini Cc: tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, emilne@redhat.com, hare@kernel.org, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, jrani@purestorage.com, randyj@purestorage.com Subject: Re: [PATCH v4 1/6] nvme: multipath: Implemented new iopolicy "queue-depth" Message-ID: References: <20240514175322.19073-1-jmeneghi@redhat.com> <20240514175322.19073-2-jmeneghi@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240514175322.19073-2-jmeneghi@redhat.com> On Tue, May 14, 2024 at 01:53:17PM -0400, John Meneghini wrote: > @@ -130,6 +133,7 @@ void nvme_mpath_start_request(struct request *rq) > if (!blk_queue_io_stat(disk->queue) || blk_rq_is_passthrough(rq)) > return; > > + atomic_inc(&ns->ctrl->nr_active); Why skip passthrough and stats? And I think you should squash the follow up patch that constrains the atomics to the queue-depth path selector. > +static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head) > +{ > + struct nvme_ns *best_opt = NULL, *best_nonopt = NULL, *ns; > + unsigned int min_depth_opt = UINT_MAX, min_depth_nonopt = UINT_MAX; > + unsigned int depth; > + > + list_for_each_entry_rcu(ns, &head->list, siblings) { > + if (nvme_path_is_disabled(ns)) > + continue; > + > + depth = atomic_read(&ns->ctrl->nr_active); > + > + switch (ns->ana_state) { > + case NVME_ANA_OPTIMIZED: > + if (depth < min_depth_opt) { > + min_depth_opt = depth; > + best_opt = ns; > + } > + break; > + > + case NVME_ANA_NONOPTIMIZED: > + if (depth < min_depth_nonopt) { > + min_depth_nonopt = depth; > + best_nonopt = ns; > + } > + break; > + default: > + break; > + } > + } > + I think you can do the atomic_inc here so you don't have to check the io policy a 2nd time. > + return best_opt ? best_opt : best_nonopt; > +}