Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1008423ybl; Thu, 23 Jan 2020 11:47:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzXNXjmE8IlPPBdilwRlNhv0TJCTDs2stQ+tta1LJy5dFBItAyKvyEDSs8zT925hdkc/ESC X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr13118461otq.75.1579808852979; Thu, 23 Jan 2020 11:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579808852; cv=none; d=google.com; s=arc-20160816; b=ZLAVlIPbUPhOiS8eI9MBA38hLMFgxqOJJ/gMHdNb6kZgte9iB/j/X73C+V114jNzMk aoaiBINUQzKzzELETcTC/ufejGtHOV1mn3ArqutMHgdvmuprXbkFhb3MldJZDbc2JB0O Ur5Hsy/Y1DixM5Up+ZfI+W6pKQIoEMJDsbDpOmt9VFw7cj1AbDN0J1CO0ZitE1CEAwIE wEULe8A9oLCuCCv9Wrb3fJbCGQim7BIM3QW/fnw4v4jEN1v5q8rCgrivF7Lldz6wBJ56 x/tGHRNXw3HlGzUfoXx+K2puiM99fyx3TjFHkXuLc+XqUbDG4ikBf2MDgwn/Kd/g2N+9 G03Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vD4wEhXBPUbSTT+g/nmEXsPL8ISOhsNfJaDqZ0hs+YQ=; b=U2uvtlvc+/4R4L4ofmXmtU9FU3MiOmeRpu/aukK/jpCfAyXLZE5MyA4s537WV3mmRl 5RkqpIeoFFIrFWUeIFllE92XDQtictzmz97L6kx8RfTFddSzV38tfEHvL6OhUFShBAwN H6lGuW81RNQg2cxOKCsL3Z0ox0a2C47XwWRZ8EbN5Vuy8Dd2btnjBehlEElamKttB+Nz 3Jh+JBV3nfmOJ2glGr8qmH4wwN+Fkm2FOwT2w6FQbN4JyV6yQwHSLojMIQxEPrPmT13z nrEP169/4Ss9m45xweyq1EneWy1UAiMyxInaFkdv0E90RYKTR8t0sah8jolpdQ73NC7l ft3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rubrik.com header.s=google header.b=bLchwNI2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rubrik.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j16si1657914otq.23.2020.01.23.11.47.20; Thu, 23 Jan 2020 11:47:32 -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=@rubrik.com header.s=google header.b=bLchwNI2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rubrik.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbgAWTqK (ORCPT + 99 others); Thu, 23 Jan 2020 14:46:10 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:34296 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgAWTqK (ORCPT ); Thu, 23 Jan 2020 14:46:10 -0500 Received: by mail-ed1-f68.google.com with SMTP id r18so2441536edl.1 for ; Thu, 23 Jan 2020 11:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rubrik.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vD4wEhXBPUbSTT+g/nmEXsPL8ISOhsNfJaDqZ0hs+YQ=; b=bLchwNI2hZ90oj87WDQHEWwcXbnaTozTTTSL+EHv4m4KWnaQBJC68uKXoeoHCn9cEM FS4HRPgQnjqDR+BLGBCzx19JUg5AdpIHwTVmWp0ZxXLbwVYKqckWsSyxERDTdWsJeAMI vpwgq536nzUzw0uS0x3oSazB98GWRNLDcDBt0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vD4wEhXBPUbSTT+g/nmEXsPL8ISOhsNfJaDqZ0hs+YQ=; b=ajcVmDaZ+C3U23FVcxZLLDNp+gptocKMdJvCuWZ85BLigaLdMEjk1E1ley/kspfm4j lHUBiVWDHTSAg6DBQ6BfOaFtmsJeDemH6NYuaQLj9tSMETTzzJieh9QD5QgFupkAATAF +W41G8KXzyi0eKzWEJkwGo0gdYv/RFMZeaVzKJwcmrAQIlAvJl96P+/RsHTu2kGks9oE iEQ74sNLeWaCaNE5RWhk31R92xFv3Q2NxIFwspbbV2jm/4bB/J10zIzvF1Of49tS88ZL olzCHAXZs7J1LOqxlK2uxWC495nyhwkBNTpjcCjpB0Zhe0v46WjhNyxjYRPLmAY5NLG+ g04Q== X-Gm-Message-State: APjAAAXvQeB7jPzJETMojYmpnfuoicAtm0bEBJmX0UH2LuwL+SXbh1eW 3TVitQUCT7BsWGTjILgdEqPr6gKBl9De76bQGu8v8UhoEg== X-Received: by 2002:a50:bf4b:: with SMTP id g11mr8184916edk.373.1579808768074; Thu, 23 Jan 2020 11:46:08 -0800 (PST) MIME-Version: 1.0 References: <20200121192540.51642-1-muraliraja.muniraju@rubrik.com> <88d16046-f9aa-d5e8-1b1c-7c3ff9516290@kernel.dk> <3c2833ef-5d7f-32ae-bbb0-01d6f812a34b@kernel.dk> In-Reply-To: <3c2833ef-5d7f-32ae-bbb0-01d6f812a34b@kernel.dk> From: Muraliraja Muniraju Date: Thu, 23 Jan 2020 11:45:57 -0800 Message-ID: Subject: Re: [PATCH] Adding multiple workers to the loop device. To: Jens Axboe Cc: linux-block , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 23, 2020 at 11:29 AM Jens Axboe wrote: > > > 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 > Sure, let me try setting the BLK_MQ_F_BLOCKING on the existing patch that I sent and see. Will update soon, Thanks.