Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1419633pxy; Fri, 23 Apr 2021 07:40:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjbSc+2G3yQlz8klat9IyY/Pl2PQjMk6QJNR//45kyXDAIXPLxDX8yqKKUGWXDizTWIThX X-Received: by 2002:a17:903:248e:b029:ec:9fd5:eef4 with SMTP id p14-20020a170903248eb02900ec9fd5eef4mr3976658plw.81.1619188815184; Fri, 23 Apr 2021 07:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619188815; cv=none; d=google.com; s=arc-20160816; b=lNR+nQ9xrm9xp0bZf9CbltQV6ZY8o7FFjpXt1dvXn9Er0Q6B6j9rnmsj7K3z93lwh9 NJm6LNKxBNm/ZCSUg3GjRoAXHwiN61RNx1tjbBMFmvQ04kz84kybzvcknXnD0gyM9jiJ q2L8ezhTLX5vdTtwFjzJX4hBVMNbVR1p4JNAKNaNxWqBmdWYjXvHTqUO3Z0Fzzitkh/n NB16i3xrKavjX++oMCxPbNPeLQYOSmtsigbdEdkI88MnuIjqImdmUJ+DBu8scslvi2oW QOTwKxMWng5tBUeJfyNKzzArsZpUJI+SAQk+kurmVIdJBie7Rl3VgOSm8ls0n7aXDxpL OZiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=jZFgm5N6/Y10vZ8zzUrUrLAgBX0ZnJqU/nldAdzP3yo=; b=vl3eGjIlYlVzC7K31gQjnWS/FCHhXAEq/jZ+ZC0gnvb6d/0BOW/gLd1ozgweMhus8W g9CiyQIOf19otOwEtDgji+BPzko6wk6geLsPC6F2hJHl11psG+FJt9pctq2EWfbdU3Ju Q7tUBl27/yEn14Jhoj25mFUlmVSoRNw/S5tM+BgoH29sRh0XBZXQVw6zHtPkSsC5jbMc kyHV+47tCxvtc3++tybbzCNvu0yHBMFtjsnc2XRg5+ALsCMsJt50Ee2LiNLcmzSLLhqD T5Ngy1XaYi1QdXKwB5F+atb2hbjbxrTBfCDcfowmNX0Xroi6ytQcPrRVdyLRPYcgcESr x3bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="H/nmXg8/"; 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 x11si6816832pfu.90.2021.04.23.07.40.02; Fri, 23 Apr 2021 07:40:15 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="H/nmXg8/"; 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 S231478AbhDWOjD (ORCPT + 99 others); Fri, 23 Apr 2021 10:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231680AbhDWOjC (ORCPT ); Fri, 23 Apr 2021 10:39:02 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F796C061756 for ; Fri, 23 Apr 2021 07:38:25 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id o16so11711401plg.5 for ; Fri, 23 Apr 2021 07:38:25 -0700 (PDT) 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=jZFgm5N6/Y10vZ8zzUrUrLAgBX0ZnJqU/nldAdzP3yo=; b=H/nmXg8/E0ixgUmYWTeY4T7YAZm8nJu/6lIcOOdwl6T70IErQa+C+/nmEvciFrZODG AsJ4tFpgqQ0PTC2/cmPf/j1lvnz9r0WpuqObAFthhmfELinTytl4QuQNEyuwUGjvWA/0 nOl/T3edHRIK2QAMCfIfwK8Vd1o0YrK9nBFdK4lHBYD7qwdS5Yi9SxWX+JZXJaU33uqG I7mmdZMntHU3YYNNDVftRW88zuQlsa0R7sLuEdNNQodd5OsvPDyri0OPxpnx/xfEq+xL oUvlsRtVT5woum7/h3hOovTdLgRYFbDYkrFKHhvv10+VmkEV83Jtpw17XVFnDrbpy/ck wr3g== 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=jZFgm5N6/Y10vZ8zzUrUrLAgBX0ZnJqU/nldAdzP3yo=; b=IrBcpnG7yLakk8crwvuK4RZeQ8YiZX9pvTClKY+wyT+2CV7iKgrJRVQNGpL5Q3FxJk nCJSgeDU8/NVFBgnzeVmDMcD8OFux8NHXYJmvNcIU6PuMApKFRByZeXCUdOpaQ4eEHA3 XIg3TrLVHwQhkv08v1jFUt97cgVaC/Lgdo3V9a2xL6WgeXoajcK1xhUzKIcvpd2VF5nt 0RS1438Sf2N1qPnEtPa+/cqcNm27ieJedrQ4aPTM0MCkIng9gRmy8g+xdhAOAedDbaDq eV/askZdkkKBYgjDJ8sLRxlCPNh/alAaRHUhRgPkvCHdwtC9ewI+jpSrg3FO0Y+J+Kvq TOxA== X-Gm-Message-State: AOAM5318/X6yzEBMhVPpCwBdAUK3Y9Ovnz7thmwcjitFf/M17jlZ0PPa 3lw8hkEZRXbpEU/k+3SbtimP+w== X-Received: by 2002:a17:902:c14d:b029:ec:acd9:d5a0 with SMTP id 13-20020a170902c14db02900ecacd9d5a0mr4006024plj.60.1619188704858; Fri, 23 Apr 2021 07:38:24 -0700 (PDT) Received: from ?IPv6:2600:380:497c:70df:6bb6:caf7:996c:9229? ([2600:380:497c:70df:6bb6:caf7:996c:9229]) by smtp.gmail.com with ESMTPSA id ms9sm7952480pjb.32.2021.04.23.07.38.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Apr 2021 07:38:24 -0700 (PDT) Subject: Re: [PATCH v8] bio: limit bio max size To: Changheun Lee , bvanassche@acm.org, Johannes.Thumshirn@wdc.com, asml.silence@gmail.com, damien.lemoal@wdc.com, gregkh@linuxfoundation.org, hch@infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ming.lei@redhat.com, osandov@fb.com, patchwork-bot@kernel.org, tj@kernel.org, tom.leiming@gmail.com Cc: jisoo2146.oh@samsung.com, junho89.kim@samsung.com, mj0123.lee@samsung.com, seunghwan.hyun@samsung.com, sookwan7.kim@samsung.com, woosung2.lee@samsung.com, yt0928.kim@samsung.com References: <20210421094745.29660-1-nanich.lee@samsung.com> From: Jens Axboe Message-ID: <2f881b00-e434-d713-8cfc-18162a16f7f7@kernel.dk> Date: Fri, 23 Apr 2021 08:38:25 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210421094745.29660-1-nanich.lee@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/21/21 3:47 AM, Changheun Lee wrote: > bio size can grow up to 4GB when muli-page bvec is enabled. > but sometimes it would lead to inefficient behaviors. > in case of large chunk direct I/O, - 32MB chunk read in user space - > all pages for 32MB would be merged to a bio structure if the pages > physical addresses are contiguous. it makes some delay to submit > until merge complete. bio max size should be limited to a proper size. > > When 32MB chunk read with direct I/O option is coming from userspace, > kernel behavior is below now in do_direct_IO() loop. it's timeline. > > | bio merge for 32MB. total 8,192 pages are merged. > | total elapsed time is over 2ms. > |------------------ ... ----------------------->| > | 8,192 pages merged a bio. > | at this time, first bio submit is done. > | 1 bio is split to 32 read request and issue. > |---------------> > |---------------> > |---------------> > ...... > |---------------> > |--------------->| > total 19ms elapsed to complete 32MB read done from device. | > > If bio max size is limited with 1MB, behavior is changed below. > > | bio merge for 1MB. 256 pages are merged for each bio. > | total 32 bio will be made. > | total elapsed time is over 2ms. it's same. > | but, first bio submit timing is fast. about 100us. > |--->|--->|--->|---> ... -->|--->|--->|--->|--->| > | 256 pages merged a bio. > | at this time, first bio submit is done. > | and 1 read request is issued for 1 bio. > |---------------> > |---------------> > |---------------> > ...... > |---------------> > |--------------->| > total 17ms elapsed to complete 32MB read done from device. | > > As a result, read request issue timing is faster if bio max size is limited. > Current kernel behavior with multipage bvec, super large bio can be created. > And it lead to delay first I/O request issue. Applied, thanks. -- Jens Axboe