Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1572325pxb; Wed, 10 Feb 2021 11:25:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzG2pMbygDOH3OqGmq2sl1y6tme4seT8Jb/IbV2WCb48rZ723ysBjRg+pJLXdZEIkrpVubg X-Received: by 2002:a17:906:3649:: with SMTP id r9mr4412775ejb.202.1612985146653; Wed, 10 Feb 2021 11:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612985146; cv=none; d=google.com; s=arc-20160816; b=H6k1hZAKhC/q/hZhIIvNBIRnyJ5OhqLpoHVDqAHtClcLT1waTFvl2sDErqG9Tn68mR Xg3TiGX8WEs3wSr98oQd5R3Z2Ebc9dMcCzAb26SfQX4DrIbhcjLk7sTW6x6HhgqSHDkA eyLFmkh0F0m2i/m47dmFbHgQ/3eGsmzpJUzhwPTtJt07GwRprIvMAY3RbYvx4BwJFljw mUMDofvT9fsOMebeHZHqGfb4FkhvY8fbEaNauDe6Ci8r/xfUZOuc6DM/VLrZjhMg8/u+ vOtZZYdc+A7ZMLGqiiBPoxerLCIdKa7+qqa5OdLvrpW7iQelCNBLIZ8F7WcpdZiOdFMh Qi4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Q4iAR12XMMN1ocsNN1Tswhea1+dTll5+pVntEH2OpZQ=; b=GkOg3tJ26wFclk/NTwh1DVAk7u+JZ6locrjc7wMOOE0wz2LRRVOKgbg2ACo8CB9ifY yRkPoyp7A2EJTxZDolcnVJ9PIjTBZWaxR9K1XABvy7uLlO30sKmwDuCbpfSD/aWeu3fK H7TIGhOrdO6Ds3a1cUdkcjnCYitNAXRz6RikPaqxJoF8kOlAo1lClvCdUPKof6kYsyyE iAUHeyY1F9Y/PPXp2qSU/HLkIES5f1ym/mbK29fDkuh7fnH7+C9qXAc6ezUMbPWJhED4 8XwfcXVE9Lpe5YulXWNGaDt/HQBF35le609u0QkG+DbaEEXGfWGrvXBKPl3PTrPZGtkm m/aQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hj12si1895576ejb.577.2021.02.10.11.25.21; Wed, 10 Feb 2021 11:25:46 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233832AbhBJTXz (ORCPT + 99 others); Wed, 10 Feb 2021 14:23:55 -0500 Received: from mx2.suse.de ([195.135.220.15]:38962 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233781AbhBJTXx (ORCPT ); Wed, 10 Feb 2021 14:23:53 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AADE7AC6E; Wed, 10 Feb 2021 19:23:09 +0000 (UTC) Date: Wed, 10 Feb 2021 19:23:04 +0000 From: Michal Rostecki To: =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Chris Mason , Josef Bacik , David Sterba , "open list:BTRFS FILE SYSTEM" , open list , Michal Rostecki Subject: Re: [PATCH RFC 6/6] btrfs: Add roundrobin raid1 read policy Message-ID: <20210210192304.GA28777@wotan.suse.de> References: <20210209203041.21493-1-mrostecki@suse.de> <20210209203041.21493-7-mrostecki@suse.de> <20210210042428.GC12086@qmqm.qmqm.pl> <20210210122925.GB23499@wotan.suse.de> <20210210125815.GA20903@qmqm.qmqm.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210210125815.GA20903@qmqm.qmqm.pl> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 01:58:15PM +0100, Michał Mirosław wrote: > On Wed, Feb 10, 2021 at 12:29:25PM +0000, Michal Rostecki wrote: > > On Wed, Feb 10, 2021 at 05:24:28AM +0100, Michał Mirosław wrote: > > > This looks like it effectively decreases queue depth for non-last > > > device. After all devices are filled to queue_depth-penalty, only > > > a single mirror will be selected for next reads (until a read on > > > some other one completes). > > > > > > > Good point. And if all devices are going to be filled for longer time, > > this function will keep selecting the last one. Maybe I should select > > last+1 in that case. Would that address your concern or did you have any > > other solution in mind? > > The best would be to postpone the selection until one device becomes free > again. But if that's not doable, then yes, you could make sure it stays > round-robin after filling the queues (the scheduling will loose the > "penalty"-driven adjustment though). Or another idea - when all the queues are filled, return the mirror which has the lowest load (inflight + penalty), even though it's greater than queue depth. In that case the scheduling will not lose the penalty adjustment and the load is going to be spreaded more fair. I'm not sure if postponing the selection is that good idea. I think it's better if the request is added to the iosched queue anyway, even if the disks' queues are filled, and let the I/O scheduler handle that. The length of the iosched queue (nr_requests, attribute of the iosched) is usually greater than queue depth (attribute of the devide), which means that it's fine to schedule more requests for iosched to handle. IMO btrfs should use the information given by iosched only for heuristic mirror selection, rather than implement its own throttling logic. Does it make sense to you? An another idea could be an additional iteration in regard to nr_requests, if all load values are greater than queue depths, though it might be an overkill. I would prefer to stick to my first idea if everyone agrees. Regards, Michal