irqbalance/irqbalance-initialize-package_mask-before-using-in-d.patch
2020-07-03 17:09:39 +08:00

51 lines
1.6 KiB
Diff

From 47137bb3e74cdc35630cf48ed839bf82b4fcc01e Mon Sep 17 00:00:00 2001
From: Yunfeng Ye <yeyunfeng@huawei.com>
Date: Wed, 6 Nov 2019 11:44:43 +0800
Subject: [PATCH 39/53] irqbalance: initialize package_mask before using in
do_one_cpu()
The local variable package_mask is used without initialized. add
cpus_clear(package_mask) before using, and move it to the error path
where getting packpage_mask fail from core_siblings.
In addition, the variable cache_mask is called cpu_set() twice, which
is unnecessary, so delete the redundant code.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
cputree.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cputree.c b/cputree.c
index 8178ba8..aa69f56 100644
--- a/cputree.c
+++ b/cputree.c
@@ -299,12 +299,13 @@ static void do_one_cpu(char *path)
return;
}
- cpu_set(cpu->number, package_mask);
-
/* try to read the package mask; if it doesn't exist assume solitary */
snprintf(new_path, ADJ_SIZE(path, "/topology/core_siblings"),
"%s/topology/core_siblings", path);
- process_one_line(new_path, get_mask_from_bitmap, &package_mask);
+ if (process_one_line(new_path, get_mask_from_bitmap, &package_mask)) {
+ cpus_clear(package_mask);
+ cpu_set(cpu->number, package_mask);
+ }
/* try to read the package id */
snprintf(new_path, ADJ_SIZE(path, "/topology/physical_package_id"),
@@ -313,7 +314,6 @@ static void do_one_cpu(char *path)
/* try to read the cache mask; if it doesn't exist assume solitary */
/* We want the deepest cache level available */
- cpu_set(cpu->number, cache_mask);
max_cache_index = 0;
cache_index = 1;
do {
--
2.23.0