From patchwork Wed Feb 22 10:14:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9586525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46EA66020B for ; Wed, 22 Feb 2017 10:14:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DC072891A for ; Wed, 22 Feb 2017 10:14:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32216288EA; Wed, 22 Feb 2017 10:14:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE2CD288F2 for ; Wed, 22 Feb 2017 10:14:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932177AbdBVKOo (ORCPT ); Wed, 22 Feb 2017 05:14:44 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36659 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932138AbdBVKOc (ORCPT ); Wed, 22 Feb 2017 05:14:32 -0500 Received: by mail-pg0-f67.google.com with SMTP id z128so1669767pgb.3; Wed, 22 Feb 2017 02:14:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b8tm1UD079ZtofS9n/cboHFASnjw8pCwJzEps8ZEM30=; b=Aw1z8dKJeqvIHWeK5WgpPdL5X9ODPgK0lN+ZeqVOA7DDH7VYp5LOdxqCCqgHP4f1cb URqa2zkRca7eB6ZyL2zI3xJH0Bi3IsQJoNwn2xSktKHGbFQryHwj1yXoqHpQ1goVWWi6 esJuRV+11XJ7dGM8bbdEi8OSbtbn+bb9JMklB3aLc3avv8D02heLdxbhpotR/zoMZIc6 MlPWQniRwIgdvdJdwZhhTI2JJTiMhmmoiCXrHBEQVjJ3uNhxHb90ZRAaQ0H7YOHbU9ay tUAnW440lm0/E8a7iVRnUlt1QABBF0tGdALCUR4lKwRs5lAqxTp4ruks2hoTAcjRXkc1 xu9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b8tm1UD079ZtofS9n/cboHFASnjw8pCwJzEps8ZEM30=; b=ek1m2VQd8GpDctH/3tNPKqr+GnWTp+QtdDemwP3tr+J/u2/FgiCfns7EuUKalQqXbU lEZdHmUTVR+F/vdloAIx3zgrcjLhLump3h2/6C3pJr9snwwnTrghoCL4vw3JH+ir5R+/ +zJPBW7norbABDRF17q8ETD35byxrvIt7rZ+lOsGFfltOwl60Bk9wgWK1ttXeknNB3rL yYMbjAm1RMbBfQ/In3xSBS6VTcWwaZLcyyAvW7lhPFDp0xrYEv4fvOC7iL3nZCcVTVyl gF+4OeblR813ZgvWj7UZgi09y+JkBtnD6zN9nsmFf1lneipxuun5EyoriqXcxhipNPaB ANxQ== X-Gm-Message-State: AMke39nClUmiWLzJTfiyMb4HLma8EE1lzmJeC8T31kj6Xw10HA9Uj7ie1OQS+3ov1liW/Q== X-Received: by 10.99.185.1 with SMTP id z1mr34658485pge.133.1487758471228; Wed, 22 Feb 2017 02:14:31 -0800 (PST) Received: from localhost ([45.35.47.137]) by smtp.gmail.com with ESMTPSA id y67sm2615633pfa.96.2017.02.22.02.14.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Feb 2017 02:14:30 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig , Omar Sandoval Cc: Ming Lei Subject: [PATCH 4/4] blk-mq: free hctx->cpumask in release handler of hctx's kobject Date: Wed, 22 Feb 2017 18:14:02 +0800 Message-Id: <1487758442-5855-5-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487758442-5855-1-git-send-email-tom.leiming@gmail.com> References: <1487758442-5855-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is obviously that hctx->cpumask is per hctx, and both share same lifetime, so this patch moves freeing of hctx->cpumask into release handler of hctx's kobject. Signed-off-by: Ming Lei --- block/blk-mq-sysfs.c | 1 + block/blk-mq.c | 12 ------------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c index cb19ec16a7fc..d745ab81033a 100644 --- a/block/blk-mq-sysfs.c +++ b/block/blk-mq-sysfs.c @@ -21,6 +21,7 @@ static void blk_mq_hw_sysfs_release(struct kobject *kobj) { struct blk_mq_hw_ctx *hctx = container_of(kobj, struct blk_mq_hw_ctx, kobj); + free_cpumask_var(hctx->cpumask); kfree(hctx->ctxs); kfree(hctx); } diff --git a/block/blk-mq.c b/block/blk-mq.c index 993bb4d4d909..db97f53e99d0 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1851,16 +1851,6 @@ static void blk_mq_exit_hw_queues(struct request_queue *q, } } -static void blk_mq_free_hw_queues(struct request_queue *q, - struct blk_mq_tag_set *set) -{ - struct blk_mq_hw_ctx *hctx; - unsigned int i; - - queue_for_each_hw_ctx(q, hctx, i) - free_cpumask_var(hctx->cpumask); -} - static int blk_mq_init_hctx(struct request_queue *q, struct blk_mq_tag_set *set, struct blk_mq_hw_ctx *hctx, unsigned hctx_idx) @@ -2229,7 +2219,6 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set, if (hctx->tags) blk_mq_free_map_and_requests(set, j); blk_mq_exit_hctx(q, set, hctx, j); - free_cpumask_var(hctx->cpumask); kobject_put(&hctx->kobj); hctxs[j] = NULL; @@ -2342,7 +2331,6 @@ void blk_mq_free_queue(struct request_queue *q) blk_mq_del_queue_tag_set(q); blk_mq_exit_hw_queues(q, set, set->nr_hw_queues); - blk_mq_free_hw_queues(q, set); } /* Basically redo blk_mq_init_queue with queue frozen */