Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1924680imm; Tue, 22 May 2018 11:33:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr+q3e3lTawCmoelgaIsWJAEnLyLJQwUdG975FBBhkbiOwFepMw2udWiMHOJz5E06xlLEZo X-Received: by 2002:a63:a312:: with SMTP id s18-v6mr19723228pge.187.1527014001942; Tue, 22 May 2018 11:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527014001; cv=none; d=google.com; s=arc-20160816; b=mOaYCO0s7aOALwoZvfmGJk/Xr6mWB/qZ9IG9qq1HRKz81RNOav8FzBz21RjzMZ01sA Pu1964jNioK4wFdRc2uOTp3mLaTxQZEHPzA+DZDUxREA4c8UpRuhmvDv1wNhJdoA7zHb N6cuFq0UoXauNBBR3KCzlLd46C9xPfj7DMNfONcuf2/4HTWATT6hCIZRn/LrEWjRH0vg Lb/ZN7URQ+uiB7qOGoNmmbZVuf8gHu1NGe+YmnSu39zRsOSXc5od+Hmwwi4FxjZOnNJ+ XFftCpim+qZ+3TicTBeCVuiK/Fid/fs+41vd/JvFxwSxu3cOx5nlQE5rWDQ5DRUdB6HI RCOQ== 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:organization:from:references:cc:to:subject :arc-authentication-results; bh=E6YpR8AlPSVpSDsYde4luIUjlGOPXY30oDZizs09/h8=; b=qZXpNstdgB4eKVrW6QwrF8bLeasvervxO60v8WU1OUBZnR3Jq6xnvjI7f0pVL1uKdW V9xgxxnwOQvQ5ycUExzQMv6FrWnxOd1+kWjNmC7EX3A66SQCMYLTQhHijQcY7QxXoUeK QocvW4F6yrfe5JuEq7tRlkKPBf4YgFLZN36/xkmEPWQPImGOHoLv4sN9zIi0tj/NJ1le MKODEx7tvJR4aAkQsARzTdwPFn1255RGeEh3FGAfXtMsI0OBTQtwU+pEQR0HTYuTzx+4 Yptw1L7PUBau1txg1YS2NfyMz1dUgBOsIDwoSb5EXW+YkRYItY7Xa4EwzrXTVqy0HFd8 0neg== ARC-Authentication-Results: i=1; mx.google.com; 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 y16-v6si16344801pfm.140.2018.05.22.11.33.07; Tue, 22 May 2018 11:33:21 -0700 (PDT) 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; 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 S1751495AbeEVScx (ORCPT + 99 others); Tue, 22 May 2018 14:32:53 -0400 Received: from mail02.iobjects.de ([188.40.134.68]:38238 "EHLO mail02.iobjects.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbeEVScw (ORCPT ); Tue, 22 May 2018 14:32:52 -0400 Received: from tux.wizards.de (pD9EBFED6.dip0.t-ipconnect.de [217.235.254.214]) by mail02.iobjects.de (Postfix) with ESMTPSA id 1684C416035F; Tue, 22 May 2018 20:32:51 +0200 (CEST) Received: from [192.168.100.223] (ragnarok.applied-asynchrony.com [192.168.100.223]) by tux.wizards.de (Postfix) with ESMTP id CF729F0160E; Tue, 22 May 2018 20:32:50 +0200 (CEST) Subject: Re: [PATCH] block: kyber: make kyber more friendly with merging To: Jens Axboe , Jianchao Wang Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <1527000509-2619-1-git-send-email-jianchao.w.wang@oracle.com> <163c5760-cf0e-faea-ee4e-ac5d688310fe@applied-asynchrony.com> <00e5dfd4-d3a2-b008-3d8b-390a788f61c9@kernel.dk> <7c93b85f-6a02-bdcf-5e92-a9533500df20@kernel.dk> From: =?UTF-8?Q?Holger_Hoffst=c3=a4tte?= Organization: Applied Asynchrony, Inc. Message-ID: Date: Tue, 22 May 2018 20:32:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <7c93b85f-6a02-bdcf-5e92-a9533500df20@kernel.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/22/18 19:46, Jens Axboe wrote: > On 5/22/18 10:20 AM, Jens Axboe wrote: >> On 5/22/18 10:17 AM, Holger Hoffstätte wrote: >>> On 05/22/18 16:48, Jianchao Wang wrote: >>>> Currently, kyber is very unfriendly with merging. kyber depends >>>> on ctx rq_list to do merging, however, most of time, it will not >>>> leave any requests in ctx rq_list. This is because even if tokens >>>> of one domain is used up, kyber will try to dispatch requests >>>> from other domain and flush the rq_list there. >>>> >>>> To improve this, we setup kyber_ctx_queue (kcq) which is similar >>>> with ctx, but it has rq_lists for different domain and build same >>>> mapping between kcq and khd as the ctx & hctx. Then we could merge, >>>> insert and dispatch for different domains separately. If one domain >>>> token is used up, the requests could be left in the rq_list of >>>> that domain and maybe merged with following io. >>>> >>>> Following is my test result on machine with 8 cores and NVMe card >>>> INTEL SSDPEKKR128G7 >>>> >>>> fio size=256m ioengine=libaio iodepth=64 direct=1 numjobs=8 >>>> seq/random >>>> +------+---------------------------------------------------------------+ >>>> |patch?| bw(MB/s) | iops | slat(usec) | clat(usec) | merge | >>>> +----------------------------------------------------------------------+ >>>> | w/o | 606/612 | 151k/153k | 6.89/7.03 | 3349.21/3305.40 | 0/0 | >>>> +----------------------------------------------------------------------+ >>>> | w/ | 1083/616 | 277k/154k | 4.93/6.95 | 1830.62/3279.95 | 223k/3k | >>>> +----------------------------------------------------------------------+ >>>> When set numjobs to 16, the bw and iops could reach 1662MB/s and 425k >>>> on my platform. >>>> >>>> Signed-off-by: Jianchao Wang >>> >>> >>> >>> This looks great but prevents kyber from being built as module, >>> which is AFAIK supposed to work (and works now): >>> >>> .. >>> CC [M] block/kyber-iosched.o >>> Building modules, stage 2. >>> MODPOST 313 modules >>> ERROR: "bio_attempt_back_merge" [block/kyber-iosched.ko] undefined! >>> ERROR: "bio_attempt_front_merge" [block/kyber-iosched.ko] undefined! >>> ERROR: "bio_attempt_discard_merge" [block/kyber-iosched.ko] undefined! >>> ERROR: "blk_try_merge" [block/kyber-iosched.ko] undefined! >>> ERROR: "blk_rq_merge_ok" [block/kyber-iosched.ko] undefined! >>> .. >>> >>> It does build fine when compiled in, obviously. :) >> >> It's basically duplicating the contents of blk_attempt_plug_merge(). >> I would suggest abstracting out the list loop and merge check >> into a helper, that could then both be called from kyber and the >> plug merge function. > > See attached, prep patch and yours rebased on top of it. That was quick. :) Applies smoothly on top of my 4.16++ tree, now builds correctly as module and is reproducibly (slightly) faster even on my pedestrian SATA SSDs, now on par or occasionally even faster than mq-deadline. What's not to like? So: Tested-by: Holger Hoffstätte cheers, Holger