lkml.org 
[lkml]   [2016]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 2/4] workqueue: free the allocated memory resource when wq_numa_init failed.
Date
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 <wanghaibin.wang@huawei.com>
---
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



\
 
 \ /
  Last update: 2016-01-07 14:21    [W:0.051 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site