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