2020-03-11 09:48:32 +08:00
|
|
|
From 0fab11043aef5b835ed5564dc15476cdbfb54d5b Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: SuperSix173 <liuchao173@huawei.com>
|
|
|
|
|
Date: Thu, 6 Feb 2020 11:43:48 +0800
|
2020-07-03 17:09:39 +08:00
|
|
|
Subject: [PATCH 49/53] free cpu_ban_string when the next request come
|
2020-03-11 09:48:32 +08:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
cputree.c | 4 ----
|
|
|
|
|
irqbalance.c | 19 +++++--------------
|
|
|
|
|
2 files changed, 5 insertions(+), 18 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/cputree.c b/cputree.c
|
|
|
|
|
index 9aa4794..bef1f40 100644
|
|
|
|
|
--- a/cputree.c
|
|
|
|
|
+++ b/cputree.c
|
|
|
|
|
@@ -118,10 +118,6 @@ static void setup_banned_cpus(void)
|
|
|
|
|
if (cpu_ban_string != NULL && banned_cpumask_from_ui != NULL) {
|
|
|
|
|
cpulist_parse(banned_cpumask_from_ui,
|
|
|
|
|
strlen(banned_cpumask_from_ui), banned_cpus);
|
|
|
|
|
- /* release it safety, it was allocated in sock_handle */
|
|
|
|
|
- free(cpu_ban_string);
|
|
|
|
|
- cpu_ban_string = NULL;
|
|
|
|
|
- banned_cpumask_from_ui = NULL;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
if (getenv("IRQBALANCE_BANNED_CPUS")) {
|
|
|
|
|
diff --git a/irqbalance.c b/irqbalance.c
|
|
|
|
|
index e76d27b..9f65c88 100644
|
|
|
|
|
--- a/irqbalance.c
|
|
|
|
|
+++ b/irqbalance.c
|
|
|
|
|
@@ -471,12 +471,9 @@ gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attri
|
|
|
|
|
free(irq_string);
|
|
|
|
|
} else if (!(strncmp(buff + strlen("settings "), "cpus ",
|
|
|
|
|
strlen("cpus")))) {
|
|
|
|
|
- /*
|
|
|
|
|
- * if cpu_ban_string has not been consumed,
|
|
|
|
|
- * just ignore this request.
|
|
|
|
|
- */
|
|
|
|
|
- if (cpu_ban_string != NULL)
|
|
|
|
|
- goto out_close;
|
|
|
|
|
+ banned_cpumask_from_ui = NULL;
|
|
|
|
|
+ free(cpu_ban_string);
|
|
|
|
|
+ cpu_ban_string = NULL;
|
|
|
|
|
|
|
|
|
|
cpu_ban_string = malloc(
|
|
|
|
|
sizeof(char) * (recv_size - strlen("settings cpus ")));
|
|
|
|
|
@@ -489,15 +486,9 @@ gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attri
|
|
|
|
|
if (!strncmp(banned_cpumask_from_ui, "NULL", strlen("NULL"))) {
|
|
|
|
|
banned_cpumask_from_ui = NULL;
|
|
|
|
|
free(cpu_ban_string);
|
|
|
|
|
- cpu_ban_string = NULL;;
|
|
|
|
|
- } else {
|
|
|
|
|
- /*
|
|
|
|
|
- * don't free cpu_ban_string at here, it will be
|
|
|
|
|
- * released after we have store it to @banned_cpus
|
|
|
|
|
- * in setup_banned_cpus function.
|
|
|
|
|
- */
|
|
|
|
|
- need_rescan = 1;
|
|
|
|
|
+ cpu_ban_string = NULL;
|
|
|
|
|
}
|
|
|
|
|
+ need_rescan = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!strncmp(buff, "setup", strlen("setup"))) {
|
|
|
|
|
--
|
2020-07-03 17:09:39 +08:00
|
|
|
2.23.0
|
2020-03-11 09:48:32 +08:00
|
|
|
|