From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753359AbcAGMlP (ORCPT ); Thu, 7 Jan 2016 07:41:15 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:12592 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320AbcAGMk4 (ORCPT ); Thu, 7 Jan 2016 07:40:56 -0500 From: wanghaibin To: CC: , , , wanghaibin Subject: [RFC PATCH 2/4] workqueue: free the allocated memory resource when wq_numa_init failed. Date: Thu, 7 Jan 2016 20:38:57 +0800 Message-ID: <1452170339-26748-3-git-send-email-wanghaibin.wang@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1452170339-26748-1-git-send-email-wanghaibin.wang@huawei.com> References: <1452170339-26748-1-git-send-email-wanghaibin.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.27.144] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.568E5CCB.0176,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 1a614f19a2bb3987c2cb6fc52c154c1f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before the return that wq_numa_init failed, it will be bettet to free the numa node table to avoid the memory leaks. Signed-off-by: wanghaibin --- kernel/workqueue.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index d6cbe3d..60e192c 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5195,6 +5195,10 @@ static void __init wq_numa_init(void) for_each_possible_cpu(cpu) { node = cpu_to_node(cpu); if (WARN_ON(node == NUMA_NO_NODE)) { + for_each_node(node) + free_cpumask_var(tbl[node]); + kfree(tbl); + pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu); /* happens iff arch is bonkers, let's just proceed */ return; -- 1.8.3.1