Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1004080ybl; Thu, 23 Jan 2020 11:42:23 -0800 (PST) X-Google-Smtp-Source: APXvYqx8e6A+S/jDdRkEU+BjRtsouJm5CDtLp7eMoMqFO39LiDC8U5OD1hPgXySnWjBUox8Ttrzd X-Received: by 2002:a05:6808:aac:: with SMTP id r12mr11738312oij.59.1579808542915; Thu, 23 Jan 2020 11:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579808542; cv=none; d=google.com; s=arc-20160816; b=Se++/OZroHQ74709ct+w1zYnUiCGgNJgp6UDY6+OZZywfqc/9dFza3LLSZn73x/UaJ awrAIb99B60cvoYE/Vuoq1G0VtBEnq3Pei+Hx42//iefDuwTgdhCGcBlvaiwCpUUVp6W 15Fh+0+NQUugk8iCg/cRHOmVrlY1zFHtcgnlzWa7b6t7eFL8z1sjuO3TD1AD69uK5up/ lCFWYhRvsrrMf4jcVGaWbspdG3reFL9+Q/L2J5o8Rzp3y7pQ98FX1EyU2s4TJ/fbNOM/ VQZk/gRfJ6/itIwvKl8eUz6PJb1HR9TB2fMOYDu980HuNhjDYNEaUbJMVITI9/sWZfrF HK8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=K+x4HS3myrT3PecWjHz3mXPh94Cn4qZCSHWdGIz+/tM=; b=oXBqZMEhPmlziaZF+/v/QwRi+gRCHTJZwgP6ToiCpXVLGjVR8+uROfLUcUK/OKbCLe toIUIpztBeG6C/GA6pygl59SYoHIyrH3eWnkGVXsj5eHnyaTUu6RX+MF0AHU9Rq7Qgtp y2KnLk0VtmvIhnFmd4m7fYRKehojQ+pxAhnl3pAVDZqypCiKpFg9yznmoZ5NcDWJyp1J UJsoalRf38Pmzlfw/1OxruUCo5XEeCSvs6dRDnTo5fbYM6EhsLsXuavmFcgyuJ5iZlB8 aOtto5RtscyYSMlPhDPlFSq+dX1rRQyAo9tUIwkXfCm0uVq6XscCLv2gwtv1q4GrepgD ESAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=EhdlXD8m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f89si1778344otf.231.2020.01.23.11.42.07; Thu, 23 Jan 2020 11:42:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=EhdlXD8m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728992AbgAWT3O (ORCPT + 99 others); Thu, 23 Jan 2020 14:29:14 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:50885 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728831AbgAWT3O (ORCPT ); Thu, 23 Jan 2020 14:29:14 -0500 Received: by mail-pj1-f66.google.com with SMTP id r67so1653849pjb.0 for ; Thu, 23 Jan 2020 11:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=K+x4HS3myrT3PecWjHz3mXPh94Cn4qZCSHWdGIz+/tM=; b=EhdlXD8m901R8DmbxPcX0bZX6RHF6nU7OaYwQGqXA5KQRU9S6OE8JLHbjyBrdJJ6nB Js8UtcT/bMPwVijvR2McPlKnUHH4EghiVcxLKqp5TDRfLY+OmdvqjjE/Lpo+4JtehBrd 9y1CeWFQQ90iGyfLy2FlcIiKAIvRkQMhuMo3M/SjxmWxTKVKJsZ9TOkVS+tl/mZASEBr 3auDDZunIASjl7zlGwbH6mmS1lV3jgrAlxxUChkLGo9d5/5Vh6OMKouq34NbPYOyCAZy VZwWJCWFiyOXufSYcz1f9zFHvnHICGJ6fQcLtlBNPA8fEKk90RijffMd/DHWrg78JXsk ssQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=K+x4HS3myrT3PecWjHz3mXPh94Cn4qZCSHWdGIz+/tM=; b=pqZc2IgI0o1dnaGQ/v95S0Aos+Lr/vpILlk3zDCdKhUHAF9JFDIAZRuNKoxN1U12cO WGDk8wrWUwEkOmxmaAfUu04o3aATYTOUn8RvQKw1e7v7FTTXeP/kOc3OMQNZqi8JdF83 JNE+wR8+xWSzUO4iq1Za6g6Je1vsHnFnB0QTXbITXT/sr3TD4v1ti1rMQyO5P9T3eTbe FmEqhMVavCp+Re+H7VKXNqwYHT/N45e9EchmkSvh/CvmhGyn7fvys8fQ9zB2waaEUlpn 6pKL7mX++ENtU0zLqRNWcdYEpUf3901bXJqBEbLvC/TSwIaJcv3IvuVRkijjNtCmC1z4 TuCg== X-Gm-Message-State: APjAAAX+uBUamMcee6d2jsAbzCWM7yZKt04mRqz+SZ7a5raNXaf6+10J k7ORZ3hnhNJgYbnxI1jLNFAFFXNnMrklZA== X-Received: by 2002:a17:90a:eb14:: with SMTP id j20mr6196753pjz.95.1579807753349; Thu, 23 Jan 2020 11:29:13 -0800 (PST) Received: from ?IPv6:2600:380:4562:fb25:b980:6664:b71f:35b5? ([2600:380:4562:fb25:b980:6664:b71f:35b5]) by smtp.gmail.com with ESMTPSA id y14sm3550278pfe.147.2020.01.23.11.29.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jan 2020 11:29:12 -0800 (PST) Subject: Re: [PATCH] Adding multiple workers to the loop device. To: Muraliraja Muniraju Cc: linux-block , Linux Kernel Mailing List References: <20200121192540.51642-1-muraliraja.muniraju@rubrik.com> <88d16046-f9aa-d5e8-1b1c-7c3ff9516290@kernel.dk> From: Jens Axboe Message-ID: <3c2833ef-5d7f-32ae-bbb0-01d6f812a34b@kernel.dk> Date: Thu, 23 Jan 2020 12:29:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Please don't top post, we just lost all context here unless I had fixed it up for you. On 1/23/20 12:25 PM, Muraliraja Muniraju wrote: > > On Thu, Jan 23, 2020 at 10:59 AM Jens Axboe wrote: >> >> On 1/21/20 12:25 PM, muraliraja.muniraju wrote: >>> Current loop device implementation has a single kthread worker and >>> drains one request at a time to completion. If the underneath device is >>> slow then this reduces the concurrency significantly. To help in these >>> cases, adding multiple loop workers increases the concurrency. Also to >>> retain the old behaviour the default number of loop workers is 1 and can >>> be tuned via the ioctl. >> >> Have you considered using blk-mq for this? Right now loop just does >> some basic checks and then queues for a thread. If you bump nr_hw_queues >> up (provide a parameter for that) and set BLK_MQ_F_BLOCKING in the >> tag flags, then that might be a more viable approach for handling this. > > I see that the kernel is already is using the multi queues with the > number of hardware queues is 1. But the problem IMO is that the worker > seems to be processing 1 request at a time, to parallelize requests > and have more concurrency more workers needs to be added. I also tried > increasing the nr_hw_queues without increasing the number of workers, > I did not see any difference in performance and it stayed the same. It > allows to queue more requests but it is processed one at a time. I > have not tried with enabling BLK_MQ_F_BLOCKING though. I see that it > can schedule requests early. The experiment is useless without BLK_MQ_F_BLOCKING set, so you need that at least. With that, you _will_ see work items processed in parallel, depending on where they are queued from. -- Jens Axboe