Re: [PATCH] mm, memcg, oom: fix pre-mature allocation failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michal,

I love your patch! Yet something to improve:

[auto build test ERROR on mmotm/master]
[also build test ERROR on next-20180531]
[cannot apply to v4.17-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Michal-Hocko/mm-memcg-oom-fix-pre-mature-allocation-failures/20180531-220120
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-x078-201821 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   mm/oom_kill.c: In function 'out_of_memory':
>> mm/oom_kill.c:1157:28: error: invalid operands to binary | (have 'struct task_struct *' and 'struct mem_cgroup *')
     return !!(oc->chosen_task | oc->chosen_memcg);
               ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
>> mm/oom_kill.c:1158:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

vim +1157 mm/oom_kill.c

  1068	
  1069	/**
  1070	 * out_of_memory - kill the "best" process when we run out of memory
  1071	 * @oc: pointer to struct oom_control
  1072	 *
  1073	 * If we run out of memory, we have the choice between either
  1074	 * killing a random task (bad), letting the system crash (worse)
  1075	 * OR try to be smart about which process to kill. Note that we
  1076	 * don't have to be perfect here, we just have to be good.
  1077	 */
  1078	bool out_of_memory(struct oom_control *oc)
  1079	{
  1080		unsigned long freed = 0;
  1081		enum oom_constraint constraint = CONSTRAINT_NONE;
  1082		bool delay = false; /* if set, delay next allocation attempt */
  1083	
  1084		if (oom_killer_disabled)
  1085			return false;
  1086	
  1087		if (!is_memcg_oom(oc)) {
  1088			blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
  1089			if (freed > 0)
  1090				/* Got some memory back in the last second. */
  1091				return true;
  1092		}
  1093	
  1094		/*
  1095		 * If current has a pending SIGKILL or is exiting, then automatically
  1096		 * select it.  The goal is to allow it to allocate so that it may
  1097		 * quickly exit and free its memory.
  1098		 */
  1099		if (task_will_free_mem(current)) {
  1100			mark_oom_victim(current);
  1101			wake_oom_reaper(current);
  1102			return true;
  1103		}
  1104	
  1105		/*
  1106		 * The OOM killer does not compensate for IO-less reclaim.
  1107		 * pagefault_out_of_memory lost its gfp context so we have to
  1108		 * make sure exclude 0 mask - all other users should have at least
  1109		 * ___GFP_DIRECT_RECLAIM to get here.
  1110		 */
  1111		if (oc->gfp_mask && !(oc->gfp_mask & __GFP_FS))
  1112			return true;
  1113	
  1114		/*
  1115		 * Check if there were limitations on the allocation (only relevant for
  1116		 * NUMA and memcg) that may require different handling.
  1117		 */
  1118		constraint = constrained_alloc(oc);
  1119		if (constraint != CONSTRAINT_MEMORY_POLICY)
  1120			oc->nodemask = NULL;
  1121		check_panic_on_oom(oc, constraint);
  1122	
  1123		if (!is_memcg_oom(oc) && sysctl_oom_kill_allocating_task &&
  1124		    current->mm && !oom_unkillable_task(current, NULL, oc->nodemask) &&
  1125		    current->signal->oom_score_adj != OOM_SCORE_ADJ_MIN) {
  1126			get_task_struct(current);
  1127			oc->chosen_task = current;
  1128			oom_kill_process(oc, "Out of memory (oom_kill_allocating_task)");
  1129			return true;
  1130		}
  1131	
  1132		if (mem_cgroup_select_oom_victim(oc) && oom_kill_memcg_victim(oc)) {
  1133			delay = true;
  1134			goto out;
  1135		}
  1136	
  1137		select_bad_process(oc);
  1138		/* Found nothing?!?! Either we hang forever, or we panic. */
  1139		if (!oc->chosen_task && !is_sysrq_oom(oc) && !is_memcg_oom(oc)) {
  1140			dump_header(oc, NULL);
  1141			panic("Out of memory and no killable processes...\n");
  1142		}
  1143		if (oc->chosen_task && oc->chosen_task != INFLIGHT_VICTIM) {
  1144			oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" :
  1145					 "Memory cgroup out of memory");
  1146			delay = true;
  1147		}
  1148	
  1149	out:
  1150		/*
  1151		 * Give the killed process a good chance to exit before trying
  1152		 * to allocate memory again.
  1153		 */
  1154		if (delay)
  1155			schedule_timeout_killable(1);
  1156	
> 1157		return !!(oc->chosen_task | oc->chosen_memcg);
> 1158	}
  1159	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux