搜索

430

主题

515

帖子

2106

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2106
QQ
发表于 2020-12-3 10:30:29 4251 浏览 0 回复

Android 7.0 如何修改低内存的时候某些进程不被杀死

kernel-3.18/drivers/staging/android/lowmemorykiller.c
  1. @@ -149,6 +149,21 @@ static unsigned long lowmem_count(struct shrinker *s,
  2.          global_page_state(NR_INACTIVE_FILE);
  3. }

  4. +static bool lowmem_whitelist(char *name)
  5. +{
  6. +    bool ret = false;
  7. +    if (name == NULL)
  8. +        return ret;
  9. +
  10. +    if ((!strcmp(name, "io.vsim.agent")) ||
  11. +        (!strcmp(name, "io.vsim.bridge"))) {
  12. +        ret = true;
  13. +    }
  14. +
  15. +    return ret;
  16. +}
  17. +
  18. +
  19. static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
  20. {
  21.      struct task_struct *tsk;
  22. @@ -413,7 +428,7 @@ log_again:
  23. #endif
  24. #endif
  25.          task_unlock(p);
  26. -        if (tasksize <= 0)
  27. +        if ((tasksize <= 0) || (lowmem_whitelist(p->comm) == true))
  28.              continue;
  29.          if (selected) {
  30.              if (oom_score_adj < selected_oom_score_adj)
复制代码




手机微信同号:13682654092
回复

使用道具 举报

返回列表
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


登录或注册
快速回复 返回顶部 返回列表