Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp75846ybz; Thu, 23 Apr 2020 18:44:41 -0700 (PDT) X-Google-Smtp-Source: APiQypLMQ+pALsT0I7EPpaDvf1aADsAi6GAwYOrjkc1CA7Hy8soEtsA5gueep5mB/U1OEw3fHsky X-Received: by 2002:a50:9d47:: with SMTP id j7mr5054281edk.296.1587692681283; Thu, 23 Apr 2020 18:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587692681; cv=none; d=google.com; s=arc-20160816; b=X4MwLfF3u8BXEV3iVUA54Oa1ydfJMSzy1FSMy2t6ZTpniLR+oUETL3bwsQ4LmAucjp AQ9VKmOVIukUOWvkU7KWWzHa7zDFT/ZHTWnV+r/OzMfpY1w1MdygLI2Tz6tp+2wG/adE WliZ96rRCs8tuC0DqXUhG/3sjyivI0zQsjnN4adWe2d1yeCF5DWL3JKWcG/LoXxPs25u r6AxLt23pVbpLMgTqaFT99+xn4aSkx8vpuYy6NUEY1v2kF1R3uce1YwAoce/ue7lPiWQ KDMkVkPAFX7BZx3lWkfiXqQ+jlELGV2xzeh93mXZSBIFeeJ0fm4P/nrntrfJWIk19Lr8 FAEA== 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=l23qZuUbbo3ViqI2ySplyyQqRUP3mFV2loomTBalDSY=; b=rfqQ1wOXFWANA/G2DjbXcKKRez9xbpNO6sd8NefEEzMQQu0m7/SVvsFVAoJPdguqVQ mSfgJBPtK/QixdBnfVnrVDdFOd+XK9sbwsjv/5uLt93YVv2oGQgnqCaGNsTTfJjlj2ZH 5rlPR9Xf3xseLCnCOGZsnMWiVghvRvaYjseenBPpu+A0yXLhIunxPm/5fxIrX8xGRcvL DcGN2WYDkrUgPetIcY3GSlMrMC/XGCz2XLe2eSRoO719XHYTgnwPS2lO1elmF6YLktPx hx2IBjr9W9/CvEuZQ1oJZVAxJklwhFDIowxsYiQbwRLi3Yen5X5bM0lTOqbzUMbSfT08 NvKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aBYxr6F+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz15si2338650ejb.24.2020.04.23.18.44.03; Thu, 23 Apr 2020 18:44:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aBYxr6F+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726271AbgDXBmI (ORCPT + 99 others); Thu, 23 Apr 2020 21:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726021AbgDXBmH (ORCPT ); Thu, 23 Apr 2020 21:42:07 -0400 Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B1AC09B042 for ; Thu, 23 Apr 2020 18:42:07 -0700 (PDT) Received: by mail-yb1-xb42.google.com with SMTP id n188so4212031ybc.3 for ; Thu, 23 Apr 2020 18:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=l23qZuUbbo3ViqI2ySplyyQqRUP3mFV2loomTBalDSY=; b=aBYxr6F+mvuF4RXiZhZ7/TOOGek5Jbyxwkt0+kilTkf25Svp4JNtAznaaYMgJ0zZ2V boCsgBrE6gAWZuSAb+yXGK13hoTcOdG0BzrLNe8eI1wJwAuHhwnJXMY4WWYxUzOiWWg2 59XkDBcRCM5sXCuWkJT7KifzI9p3kRz53WDtTRUB33pY2ELqKulePRiTtSHHwguyjgLU quQSa7k/sAIrC/AHdoJ+sOFh/zYRJOkRDVb36tJ4A+Ayd/84eSZY00bREHMni3TLB2U0 YyRRhn0dqt3We39e8uXhyWsHjFamurc+3GipKEQ9KDKfAMs4GusXDoCM8IGvDwJfl1li 2buw== 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=l23qZuUbbo3ViqI2ySplyyQqRUP3mFV2loomTBalDSY=; b=Swh1abWX+FWk4LfY0BaJBJxloGJxWLFKsNWCflREn6fLPPq9UNHm1Bh0S+3eD7IkU0 phMwncElS0xiG8PTIi8S+wkxOlV73U8oN2kT52hBKjwytZZ2wA0PiiNUVPXOJEdDvYFe aqXalTh0FulGvp33BEpCXaqQjaUAzuAj9xh4+mzsVTLtERu4xtJR2/SLfAbDqrcSCHAD sOwMq5wOJ0nnOll5Q0SyDW/doocl+8oXWO6JsnZt2FrdQgVCuCK4YNIYg5joafvw4XSK gsTGJJJyxtP8nnAdm4k6z+oFDIdbMMTIRhRhQDlh+h2DVbf6NUqouJt28JaxdQzSKahE Fk0g== X-Gm-Message-State: AGi0Pubx26sgFr9F/F2fOYSvGiE0zTrnlllTf+FqOyWXXdj6oJcoA9tQ RVCltBoU3G9qiCR57hVA/UXMB+CiidQRSvircjIghg== X-Received: by 2002:a25:df03:: with SMTP id w3mr11870988ybg.224.1587692526417; Thu, 23 Apr 2020 18:42:06 -0700 (PDT) MIME-Version: 1.0 References: <20200423210523.52833-1-sqazi@google.com> <83078447-831c-2921-db5e-9cab4c4c12df@kernel.dk> In-Reply-To: <83078447-831c-2921-db5e-9cab4c4c12df@kernel.dk> From: Salman Qazi Date: Thu, 23 Apr 2020 18:41:54 -0700 Message-ID: Subject: Re: [PATCH v2] block: Limit number of items taken from the I/O scheduler in one go To: Jens Axboe Cc: Ming Lei , Bart Van Assche , linux-block , Linux Kernel Mailing List , Jesse Barnes , Gwendal Grignou , Hannes Reinecke , Christoph Hellwig 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 I remailed it with the changes since v1 added. But just to answer directly: Changes since v1: * Removed max_sched_batch. * Extended the fix to the software queue. * Use a return value from blk_mq_do_dispatch_sched to indicate if the dispatch should be rerun. * Some comments added. On Thu, Apr 23, 2020 at 2:30 PM Jens Axboe wrote: > > On 4/23/20 3:05 PM, Salman Qazi wrote: > > Flushes bypass the I/O scheduler and get added to hctx->dispatch > > in blk_mq_sched_bypass_insert. This can happen while a kworker is running > > hctx->run_work work item and is past the point in > > blk_mq_sched_dispatch_requests where hctx->dispatch is checked. > > > > The blk_mq_do_dispatch_sched call is not guaranteed to end in bounded time, > > because the I/O scheduler can feed an arbitrary number of commands. > > > > Since we have only one hctx->run_work, the commands waiting in > > hctx->dispatch will wait an arbitrary length of time for run_work to be > > rerun. > > > > A similar phenomenon exists with dispatches from the software queue. > > > > The solution is to poll hctx->dispatch in blk_mq_do_dispatch_sched and > > blk_mq_do_dispatch_ctx and return from the run_work handler and let it > > rerun. > > Any changes since v1? It's customary to put that in here too, below > the --- lines. > > -- > Jens Axboe >