From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, T_DKIMWL_WL_HIGH autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBEFDC4321D for ; Mon, 20 Aug 2018 03:58:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F50A20C09 for ; Mon, 20 Aug 2018 03:58:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="3N2+n+QP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F50A20C09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726032AbeHTHMX (ORCPT ); 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