Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3427389imm; Sun, 19 Aug 2018 21:00:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxrL4/2MW6i0RiABVusn3tcdrJHDUJ6Zhv6segPnHLbKWSFDRYGV3BNN51DBt/s2l/FzsI/ X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr46675460pfg.185.1534737649316; Sun, 19 Aug 2018 21:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534737649; cv=none; d=google.com; s=arc-20160816; b=GaYc1ZyjLDZaL/wqGtEHJpSePAsZK2r+gyPJVhOXBJxBONFLattxkbRq60E4EpQPkX t7UoPgQI6LfM1wuwrsSpRnmCu8eEF+uXjZOZBgBPBtAYD5W/Crv8C7h85jx9fsfCkw6f 4OIWtU9xDeJ0b7V4Tg6QWaD6i9oeSfcdaonmeJzA0jbR86ABrWLDkkPrtVKZ3seTfgaZ BW29EE/UWxJynsspDCLmqWHOxfvpEzmHrjta+/lxULEMCdqVJWvJKSPMl6TpOkPo2432 tc7tKiXlcIgZN8/Jak/v3ujEmFHhVrPvKjMe4+6oBa4YPCd2+/gVIDnUpxC+2GF46QXn xNuA== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=cnfIXCAUpun4xI4VJq7A9qrwLwMNV2rhcwaGtXPzuBg=; b=UJ5dSmoEb5HGUJEbmM+zmQe/93GAOMzvciCWGVo8g4YZMEI795BqNxzY2UxaqLt1zN JmhZjvk+KQgUwnt8G7JNqWcK8EG2qFTuPrLkGAZokP8OGCIsksIiHG2DA3jCFr3mPa0l 0Da5dEFvPwerOOH8tWyqYtd56f/EFvhZpJygNk/jo2bOH/9sXGTYAcqiTUYcpEPEDPRm f4im5GwUvmOq40sPC8Lz8TUgaaNf8+YKbZpF/D7khlJnRi5uKzohWlbb3X5pZxqMz0Tl Xo0dtJNpRQ0rXfuzkM1scAnRtwkojLAfE8tksIUpispiLYglEKBRKYJQ9DWI7EID1N8Y GgQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=3N2+n+QP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i123-v6si9056402pfe.145.2018.08.19.21.00.33; Sun, 19 Aug 2018 21:00:48 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=3N2+n+QP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726024AbeHTHMX (ORCPT + 99 others); Mon, 20 Aug 2018 03:12:23 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50224 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbeHTHMX (ORCPT ); Mon, 20 Aug 2018 03:12:23 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7K3svSq145926; Mon, 20 Aug 2018 03:57:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=cnfIXCAUpun4xI4VJq7A9qrwLwMNV2rhcwaGtXPzuBg=; b=3N2+n+QPBvtoLe02/Ps8KUeKBjyM6PDOyTBXsZhzvr8ZcG26ZxQYIDUZKd7HJ4W1P4VO GWjv3osxsK8RT/jGuzvwHMoNI5/KX/OIr0z7C6+EAi5boUsFcItSyyors5Yjd/4Xmwaz T9LFh/xcgntYf57+f+CA6ZsAmBq96t5q3BUepETPFLhFOyYXAFP6j1J5N1xj6JzttU0u pCENVFrvz/e6o5JNNxXr01acL9Ri/654rxZAFVp0Qx2RfXPegiFpGYAaCH5lpRyeGKmf HJLOQccpREQ6NSCdxYJsB3m15sd2mUo5dGzelhzrCTQrPoVeCuL3UrX5iGtbotOeLBoJ yA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2kxc3qbwta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Aug 2018 03:57:21 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w7K3vKrB013347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Aug 2018 03:57:20 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w7K3vJM1026080; Mon, 20 Aug 2018 03:57:19 GMT Received: from [10.182.70.180] (/10.182.70.180) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 19 Aug 2018 20:57:19 -0700 Subject: Re: [PATCH V2 1/2] blk-mq: init hctx sched after update ctx and hctx mapping To: Ming Lei Cc: Jens Axboe , Bart Van Assche , Keith Busch , linux-block , Linux Kernel Mailing List , Ming Lei 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> From: "jianchao.wang" Message-ID: <3ce9f249-4c2f-89a6-727f-9bc449a4fdf4@oracle.com> Date: Mon, 20 Aug 2018 11:57:52 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8990 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808200041 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks Jianchao