Blame SOURCES/b22be68453b2497e86cbd273b9cd56fadc5859e3.patch
|
|
8b31a8 |
commit b22be68453b2497e86cbd273b9cd56fadc5859e3
|
|
|
8b31a8 |
Author: Ying Lv <lvying6@huawei.com>
|
|
|
8b31a8 |
Date: Wed May 15 11:15:42 2019 +0800
|
|
|
8b31a8 |
|
|
|
8b31a8 |
fix rasdaemon high CPU usage when part of CPUs offline
|
|
|
8b31a8 |
|
|
|
8b31a8 |
When we set part of CPU core offline, such as by setting the kernel cmdline
|
|
|
8b31a8 |
maxcpus = N(N is less than the total number of system CPU cores).
|
|
|
8b31a8 |
And then, we will observe that the CPU usage of some rasdaemon threads
|
|
|
8b31a8 |
is very close to 100.
|
|
|
8b31a8 |
|
|
|
8b31a8 |
This is because when part of CPU offline, poll in read_ras_event_all_cpus func
|
|
|
8b31a8 |
will fallback to pthread way.
|
|
|
8b31a8 |
Offlined CPU thread will return negative value when read trace_pipe_raw,
|
|
|
8b31a8 |
negative return value will covert to positive value because of 'unsigned size'.
|
|
|
8b31a8 |
So code will always go into 'size > 0' branch, and the CPU usage is too high.
|
|
|
8b31a8 |
|
|
|
8b31a8 |
Here, variable size uses int type will go to the right branch.
|
|
|
8b31a8 |
|
|
|
8b31a8 |
Fiexs: eff7c9e0("ras-events: Only use pthreads for collect if poll() not available")
|
|
|
8b31a8 |
Reported-by: Zhipeng Xie <xiezhipeng1@huawei.com>
|
|
|
8b31a8 |
Signed-off-by: Ying Lv <lvying6@huawei.com>
|
|
|
8b31a8 |
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
|
|
8b31a8 |
|
|
|
8b31a8 |
diff --git a/ras-events.c b/ras-events.c
|
|
|
8b31a8 |
index 4e7b815..38ebe1e 100644
|
|
|
8b31a8 |
--- a/ras-events.c
|
|
|
8b31a8 |
+++ b/ras-events.c
|
|
|
8b31a8 |
@@ -426,7 +426,7 @@ static int read_ras_event(int fd,
|
|
|
8b31a8 |
struct kbuffer *kbuf,
|
|
|
8b31a8 |
void *page)
|
|
|
8b31a8 |
{
|
|
|
8b31a8 |
- unsigned size;
|
|
|
8b31a8 |
+ int size;
|
|
|
8b31a8 |
unsigned long long time_stamp;
|
|
|
8b31a8 |
void *data;
|
|
|
8b31a8 |
|