summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongwoo Lee <dwoo08.lee@samsung.com>2023-01-03 11:32:24 +0900
committerDongwoo Lee <dwoo08.lee@samsung.com>2023-01-03 11:32:24 +0900
commit0df331d04090a9c0c9a1428f64009841f17396f9 (patch)
tree7063812b16b75886de1be6f9db2f4a0f145d9616
parent6581bf455917ae29c6f094eaf609dba24c1b3f11 (diff)
downloadresourced-sandbox/dwlee08/psi.tar.gz
resourced-sandbox/dwlee08/psi.tar.bz2
resourced-sandbox/dwlee08/psi.zip
Change-Id: I544a8a2dd0cc6d4a2ece4313a2929630dad86d32 Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
-rw-r--r--src/resource-limiter/memory/vmpressure-lowmem-handler.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/resource-limiter/memory/vmpressure-lowmem-handler.c b/src/resource-limiter/memory/vmpressure-lowmem-handler.c
index f3856c00..3a7926f9 100644
--- a/src/resource-limiter/memory/vmpressure-lowmem-handler.c
+++ b/src/resource-limiter/memory/vmpressure-lowmem-handler.c
@@ -1434,7 +1434,7 @@ struct psi_level_desc {
u_int32_t level;
};
-static const struct psi_level_desc psi_levels[] = {
+static const struct psi_level_desc lowmem_psi_levels[] = {
[MEM_LEVEL_HIGH] = {},
[MEM_LEVEL_MEDIUM] = {
.type = PSI_TYPE_WARN,
@@ -1462,6 +1462,34 @@ static const struct psi_level_desc psi_levels[] = {
}
};
+static const struct psi_level_desc high_perf_psi_levels[] = {
+ [MEM_LEVEL_HIGH] = {},
+ [MEM_LEVEL_MEDIUM] = {
+ .type = PSI_TYPE_WARN,
+ .stall = 150000,
+ .window = 1000000,
+ .level = MEM_LEVEL_MEDIUM,
+ },
+ [MEM_LEVEL_LOW] = {
+ .type = PSI_TYPE_WARN,
+ .stall = 250000,
+ .window = 1000000,
+ .level = MEM_LEVEL_LOW,
+ },
+ [MEM_LEVEL_CRITICAL] = {
+ .type = PSI_TYPE_CRITICAL,
+ .stall = 250000,
+ .window = 1000000,
+ .level = MEM_LEVEL_CRITICAL,
+ },
+ [MEM_LEVEL_OOM] = {
+ .type = PSI_TYPE_CRITICAL,
+ .stall = 400000,
+ .window = 1000000,
+ .level = MEM_LEVEL_OOM,
+ }
+};
+
static int lowmem_register_psi_event(const struct psi_level_desc *desc)
{
struct epoll_event epoll_event;
@@ -1516,7 +1544,7 @@ static int lowmem_psi_worker(void *arg)
int event_count, i;
u_int32_t max_mem_level = 0;
- event_count = epoll_wait(epoll_psi_fd, epoll_events, 100, 10);
+ event_count = epoll_wait(epoll_psi_fd, epoll_events, 100, 1);
for (i = 0, event = &epoll_events[0]; i < event_count; i++, event++) {
if (event->events & EPOLLERR)
@@ -1542,6 +1570,7 @@ static int lowmem_psi_worker(void *arg)
static int lowmem_init_psi_events(void)
{
+ struct psi_level_desc *psi_level_desc = lowmem_psi_levels; /* or high_perf_psi_levels */
int i, ret;
epoll_psi_fd = epoll_create(1024);
@@ -1560,8 +1589,8 @@ static int lowmem_init_psi_events(void)
pthread_detach(lpw.worker_thread);
for (i = 0; i < MEM_LEVEL_MAX; i++) {
- if (psi_levels[i].type) {
- ret = lowmem_register_psi_event(&psi_levels[i]);
+ if (psi_level_desc[i].type) {
+ ret = lowmem_register_psi_event(&psi_level_desc[i]);
if (ret < 0)
goto err_cleanup_thread;
}