From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758094AbcKCO5m (ORCPT ); Thu, 3 Nov 2016 10:57:42 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:33866 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756077AbcKCO5i (ORCPT ); Thu, 3 Nov 2016 10:57:38 -0400 MIME-Version: 1.0 In-Reply-To: References: <1478034325-28232-1-git-send-email-axboe@fb.com> <1478034325-28232-2-git-send-email-axboe@fb.com> From: Ming Lei Date: Thu, 3 Nov 2016 22:57:36 +0800 Message-ID: Subject: Re: [PATCH 1/4] block: add scalable completion tracking of requests To: Jens Axboe Cc: Jens Axboe , Linux Kernel Mailing List , linux-block , Christoph Hellwig Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 3, 2016 at 9:38 PM, Jens Axboe wrote: > On 11/03/2016 05:17 AM, Ming Lei wrote: >>> >>> diff --git a/block/blk-core.c b/block/blk-core.c >>> index 0bfaa54d3e9f..ca77c725b4e5 100644 >>> --- a/block/blk-core.c >>> +++ b/block/blk-core.c >>> @@ -2462,6 +2462,8 @@ void blk_start_request(struct request *req) >>> { >>> blk_dequeue_request(req); >>> >>> + blk_stat_set_issue_time(&req->issue_stat); >>> + >>> /* >>> * We are now handing the request to the hardware, initialize >>> * resid_len to full count and add the timeout handler. >>> @@ -2529,6 +2531,8 @@ bool blk_update_request(struct request *req, int >>> error, unsigned int nr_bytes) >>> >>> trace_block_rq_complete(req->q, req, nr_bytes); >>> >>> + blk_stat_add(&req->q->rq_stats[rq_data_dir(req)], req); >> >> >> blk_update_request() is often called lockless, so it isn't good to >> do it here. > > > It's not really a concern, not for the legacy path here nor the mq one > where it is per sw context. The collisions are rare enough that it'll How do you get the conclusion that the collisions are rare enough when the counting becomes completely lockless? Even though it is true, the statistics still may become a mess with rare collisons. > skew the latencies a bit for that short window, but then go away again. > I'd much rather take that, than adding locking for this part. For legacy case, blk_stat_add() can be moved into blk_finish_request() for avoiding the collision. -- Ming Lei