Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3440216imm; Sun, 19 Aug 2018 21:20:18 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxq36asZQ/6eMnR72yK+12sr3ERthTIGKyzj+xwXE+l18MTW2SuI7NN08ZoFySVT1BWa5MI X-Received: by 2002:a62:ce05:: with SMTP id y5-v6mr46498691pfg.95.1534738818256; Sun, 19 Aug 2018 21:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534738818; cv=none; d=google.com; s=arc-20160816; b=K1CIqgCp3RvrLnddqLTAdqDQMqxY1+ppzCJ9KQYDoU9AiVEnWPx68ajijoz/Z7hita OJLzhzT0uO2rRKLI1fuxlNidLEOm9KVagEGpArpY5l80CnOJrjZRF8/kCHqw3gDuNV3M oHqvd9Fm6nduwnRDM7HbIEp3rG60pgfXhjkqnN8BOsJCbiPFIpXy7teAaftqCLv3GdNG +vXajGkve70PWS4DM9IJHfcc6RvrF0QfJ8wKf9jfuEpeksWhqZjRKiPTCqHM1y8EcLbt KBMY07nFuif3oqHUCrSZjm8zBkaeO110nUnCOq/quQEKYrf/6XbF7IykzlZsuvXh88RX f9zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=HOo+V61dIxvWBZCvVZHTr0A2CRGHNiit4b+83eWJwOo=; b=gmDWLZffBajpfGzjdj2jvYFEFlBcvgpQ466IIxtMw1PRr34tvAXiGIta7U94adRguF KzqFvyBN8goTNgGLjOv0rj5evz5Fov0NgRXQmlnc2zwbSRReAihSgcL4gHDS9QQHxhcs 6h9h3uBDWlkXfmvXXWjF9ZIwWq4Mf/k8/tM1eDLKLGimAkRgIEOzJcXsRGElmq5kEAsB Y1wgyIzAWLJ/IE9yWZXOdyIk6bcUhk7YPnkYEMlosDAqKVwadJhY0OCwSSNDaKf0oAJq OUDNDV/KvsRVM8iAbWT4zH4BkxBIFyVUQtbUwRVcl3F2v2kSndtPP7f3YslgbmuWQAAa wdqg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q65-v6si8583095pga.283.2018.08.19.21.20.02; Sun, 19 Aug 2018 21:20:18 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726024AbeHTHc5 (ORCPT + 99 others); Mon, 20 Aug 2018 03:32:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43728 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725942AbeHTHc5 (ORCPT ); Mon, 20 Aug 2018 03:32:57 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6CC22DFF6; Mon, 20 Aug 2018 04:18:57 +0000 (UTC) Received: from ming.t460p (ovpn-12-42.pek2.redhat.com [10.72.12.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 804122026D66; Mon, 20 Aug 2018 04:18:44 +0000 (UTC) Date: Mon, 20 Aug 2018 12:18:39 +0800 From: Ming Lei To: "jianchao.wang" Cc: Ming Lei , Jens Axboe , Bart Van Assche , Keith Busch , linux-block , Linux Kernel Mailing List Subject: Re: [PATCH V2 1/2] blk-mq: init hctx sched after update ctx and hctx mapping Message-ID: <20180820041833.GB21600@ming.t460p> References: <1534478043-7170-1-git-send-email-jianchao.w.wang@oracle.com> <1534478043-7170-2-git-send-email-jianchao.w.wang@oracle.com> <96657784-dd95-6ea9-3ffd-25737c534075@oracle.com> <3ce9f249-4c2f-89a6-727f-9bc449a4fdf4@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ce9f249-4c2f-89a6-727f-9bc449a4fdf4@oracle.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 20 Aug 2018 04:18:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 20 Aug 2018 04:18:57 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 20, 2018 at 11:57:52AM +0800, jianchao.wang wrote: > Hi Ming > > On 08/20/2018 10:24 AM, Ming Lei wrote: > >> The code path is: > >> > >> elevator_release > >> -> elevator_put(e->type) > >> -> module_put(e->elevator_owner) > >> > >> In normal elevator switch path, elevator_get will hold a reference counter of the > >> elevator_owner. > >> In this patch set, the elevator_type is saved directly. To prevent the io scheduler module > >> is removed, we need to hold a reference of the module. > > Yeah, I agree that the module reference need to be held, but it need to be > > released too. > > > > My concern is that this introduced getting module reference in your patch > > isn't released. The module reference is a counter too, so the get and > > put operation should be matched. > > elevator_switch_mq > -> elevator_exit > it will put a reference count of the elevator_queue associated with the request_queue. > and the elevator_release will be invoked when the reference count of elevator_queue->kobj reaches zero. > elevator_release will put the reference count of the io scheduler module. > > the elevator_queue structure will be allocated and freed every time when we switch io scheduler. > so the elevator_release will always be invoked. > > This is the put ref corresponding to the get one in this patch. OK, got it, the added __module_get() is just like what elevator_get() does from __elevator_change(). Sorry for the noise. Reviewed-by: Ming Lei Thanks, Ming