From patchwork Mon May 25 11:30:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11568761 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD4E0739 for ; Mon, 25 May 2020 11:55:15 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AECC206DD for ; Mon, 25 May 2020 11:55:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bD6UIqKh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AECC206DD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590407714; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iYz+1QgDf4xB2BRe0iMxc6UeNsXR2bv1bREV7f5pnVc=; b=bD6UIqKhHuWM6smvyMpVJaQMo8mcwF1vB029LGAhKbbnYEEWhdg65/eTTj9ZfEqL9+8NzA LRgFnknXRTdWIgzV0CEme6OVxHaJjXHs/DEqgolYOeCxcaa8PtwwiMMp3WbxARFvJOl3R5 o6JFJPVPZRQTnDn5WQiMohYiq0rBqCc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-gNEM9lzMOaqjZkgS4b2Rxw-1; Mon, 25 May 2020 07:55:12 -0400 X-MC-Unique: gNEM9lzMOaqjZkgS4b2Rxw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E321919067E3; Mon, 25 May 2020 11:55:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4BBF10013D7; Mon, 25 May 2020 11:55:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9DEE91809554; Mon, 25 May 2020 11:55:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04PBt5cw007474 for ; Mon, 25 May 2020 07:55:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id E9FF642AC0; Mon, 25 May 2020 11:55:03 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E360542AB2 for ; Mon, 25 May 2020 11:54:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 27693108C269 for ; Mon, 25 May 2020 11:54:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-305-tFyVAKXeMTGB19Z-2EUrgg-1; Mon, 25 May 2020 07:54:51 -0400 X-MC-Unique: tFyVAKXeMTGB19Z-2EUrgg-1 Received: from [2001:4bb8:18c:5da7:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdBJw-0002cF-Pu; Mon, 25 May 2020 11:31:05 +0000 From: Christoph Hellwig To: Jens Axboe Date: Mon, 25 May 2020 13:30:14 +0200 Message-Id: <20200525113014.345997-17-hch@lst.de> In-Reply-To: <20200525113014.345997-1-hch@lst.de> References: <20200525113014.345997-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: dm-devel@redhat.com Cc: linux-nvdimm@lists.01.org, Konstantin Khlebnikov , linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Minchan Kim , dm-devel@redhat.com, drbd-dev@tron.linbit.com, Nitin Gupta Subject: [dm-devel] [PATCH 16/16] block: reduce part_stat_lock() scope X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com We only need the stats lock (aka preempt_disable()) for updating the states, not for looking up or dropping the hd_struct reference. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 5 +++-- block/blk-merge.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index bf2f7d4bc0c1c..a01fb2b508f0e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1437,9 +1437,9 @@ void blk_account_io_done(struct request *req, u64 now) update_io_ticks(part, jiffies, true); part_stat_inc(part, ios[sgrp]); part_stat_add(part, nsecs[sgrp], now - req->start_time_ns); + part_stat_unlock(); hd_struct_put(part); - part_stat_unlock(); } } @@ -1448,8 +1448,9 @@ void blk_account_io_start(struct request *rq) if (!blk_do_io_stat(rq)) return; - part_stat_lock(); rq->part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq)); + + part_stat_lock(); update_io_ticks(rq->part, jiffies, false); part_stat_unlock(); } diff --git a/block/blk-merge.c b/block/blk-merge.c index c3beae5c1be71..f0b0bae075a0c 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -674,8 +674,9 @@ static void blk_account_io_merge_request(struct request *req) if (blk_do_io_stat(req)) { part_stat_lock(); part_stat_inc(req->part, merges[op_stat_group(req_op(req))]); - hd_struct_put(req->part); part_stat_unlock(); + + hd_struct_put(req->part); } }