Re: [PATCH v12 3/3] mm: Implement precise OOM killer task selection
From: Dan Carpenter
Date: Mon Jan 12 2026 - 03:06:32 EST
Hi Mathieu,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mathieu-Desnoyers/lib-Introduce-hierarchical-per-cpu-counters/20260111-231206
base: next-20260109
patch link: https://lore.kernel.org/r/20260111150249.1222944-4-mathieu.desnoyers%40efficios.com
patch subject: [PATCH v12 3/3] mm: Implement precise OOM killer task selection
config: s390-randconfig-r071-20260112 (https://download.01.org/0day-ci/archive/20260112/202601120452.VufCnz2j-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 14.3.0
smatch version: v0.5.0-8985-g2614ff1a
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202601120452.VufCnz2j-lkp@xxxxxxxxx/
smatch warnings:
mm/oom_kill.c:392 oom_evaluate_task() error: uninitialized symbol 'points_min'.
vim +/points_min +392 mm/oom_kill.c
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 322 static int oom_evaluate_task(struct task_struct *task, void *arg)
462607ecc519b19 David Rientjes 2012-07-31 323 {
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 324 struct oom_control *oc = arg;
72456781289a6ed Mathieu Desnoyers 2026-01-11 325 unsigned long accuracy_under = 0, accuracy_over = 0;
72456781289a6ed Mathieu Desnoyers 2026-01-11 326 long points, points_min, points_max;
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 327
ac311a14c682dcd Shakeel Butt 2019-07-11 328 if (oom_unkillable_task(task))
ac311a14c682dcd Shakeel Butt 2019-07-11 329 goto next;
ac311a14c682dcd Shakeel Butt 2019-07-11 330
ac311a14c682dcd Shakeel Butt 2019-07-11 331 /* p may not have freeable memory in nodemask */
ac311a14c682dcd Shakeel Butt 2019-07-11 332 if (!is_memcg_oom(oc) && !oom_cpuset_eligible(task, oc))
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 333 goto next;
462607ecc519b19 David Rientjes 2012-07-31 334
462607ecc519b19 David Rientjes 2012-07-31 335 /*
462607ecc519b19 David Rientjes 2012-07-31 336 * This task already has access to memory reserves and is being killed.
a373966d1f64c04 Michal Hocko 2016-07-28 337 * Don't allow any other task to have access to the reserves unless
862e3073b3eed13 Michal Hocko 2016-10-07 338 * the task has MMF_OOM_SKIP because chances that it would release
a373966d1f64c04 Michal Hocko 2016-07-28 339 * any memory is quite low.
462607ecc519b19 David Rientjes 2012-07-31 340 */
862e3073b3eed13 Michal Hocko 2016-10-07 341 if (!is_sysrq_oom(oc) && tsk_is_oom_victim(task)) {
12e423ba4eaed7b Lorenzo Stoakes 2025-08-12 342 if (mm_flags_test(MMF_OOM_SKIP, task->signal->oom_mm))
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 343 goto next;
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 344 goto abort;
a373966d1f64c04 Michal Hocko 2016-07-28 345 }
462607ecc519b19 David Rientjes 2012-07-31 346
e1e12d2f3104be8 David Rientjes 2012-12-11 347 /*
e1e12d2f3104be8 David Rientjes 2012-12-11 348 * If task is allocating a lot of memory and has been marked to be
e1e12d2f3104be8 David Rientjes 2012-12-11 349 * killed first if it triggers an oom, then select it.
e1e12d2f3104be8 David Rientjes 2012-12-11 350 */
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 351 if (oom_task_origin(task)) {
9066e5cfb73cdbc Yafang Shao 2020-08-11 352 points = LONG_MAX;
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 353 goto select;
points_min is uninitialized.
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 354 }
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 355
72456781289a6ed Mathieu Desnoyers 2026-01-11 356 points = oom_badness(task, oc->totalpages, true, &accuracy_under, &accuracy_over);
72456781289a6ed Mathieu Desnoyers 2026-01-11 357 if (points != LONG_MIN) {
72456781289a6ed Mathieu Desnoyers 2026-01-11 358 percpu_counter_tree_approximate_min_max_range(points,
72456781289a6ed Mathieu Desnoyers 2026-01-11 359 accuracy_under, accuracy_over,
72456781289a6ed Mathieu Desnoyers 2026-01-11 360 &points_min, &points_max);
72456781289a6ed Mathieu Desnoyers 2026-01-11 361 }
72456781289a6ed Mathieu Desnoyers 2026-01-11 362 if (oc->approximate) {
72456781289a6ed Mathieu Desnoyers 2026-01-11 363 /*
72456781289a6ed Mathieu Desnoyers 2026-01-11 364 * Keep the process which has the highest minimum
72456781289a6ed Mathieu Desnoyers 2026-01-11 365 * possible points value based on approximation.
72456781289a6ed Mathieu Desnoyers 2026-01-11 366 */
72456781289a6ed Mathieu Desnoyers 2026-01-11 367 if (points == LONG_MIN || points_min < oc->chosen_points)
72456781289a6ed Mathieu Desnoyers 2026-01-11 368 goto next;
72456781289a6ed Mathieu Desnoyers 2026-01-11 369 } else {
72456781289a6ed Mathieu Desnoyers 2026-01-11 370 /*
72456781289a6ed Mathieu Desnoyers 2026-01-11 371 * Eliminate processes which are certainly below the
72456781289a6ed Mathieu Desnoyers 2026-01-11 372 * chosen points minimum possible value with an
72456781289a6ed Mathieu Desnoyers 2026-01-11 373 * approximation.
72456781289a6ed Mathieu Desnoyers 2026-01-11 374 */
72456781289a6ed Mathieu Desnoyers 2026-01-11 375 if (points == LONG_MIN || (long)(points_max - oc->chosen_points) < 0)
72456781289a6ed Mathieu Desnoyers 2026-01-11 376 goto next;
72456781289a6ed Mathieu Desnoyers 2026-01-11 377
72456781289a6ed Mathieu Desnoyers 2026-01-11 378 if (oc->nr_precise < max_precise_badness_sums) {
72456781289a6ed Mathieu Desnoyers 2026-01-11 379 oc->nr_precise++;
72456781289a6ed Mathieu Desnoyers 2026-01-11 380 /* Precise evaluation. */
72456781289a6ed Mathieu Desnoyers 2026-01-11 381 points_min = points_max = points = oom_badness(task, oc->totalpages, false, NULL, NULL);
72456781289a6ed Mathieu Desnoyers 2026-01-11 382 if (points == LONG_MIN || (long)(points - oc->chosen_points) < 0)
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 383 goto next;
72456781289a6ed Mathieu Desnoyers 2026-01-11 384 }
72456781289a6ed Mathieu Desnoyers 2026-01-11 385 }
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 386
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 387 select:
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 388 if (oc->chosen)
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 389 put_task_struct(oc->chosen);
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 390 get_task_struct(task);
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 391 oc->chosen = task;
72456781289a6ed Mathieu Desnoyers 2026-01-11 @392 oc->chosen_points = points_min;
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 393 next:
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 394 return 0;
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 395 abort:
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 396 if (oc->chosen)
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 397 put_task_struct(oc->chosen);
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 398 oc->chosen = (void *)-1UL;
7c5f64f84483bd1 Vladimir Davydov 2016-10-07 399 return 1;
462607ecc519b19 David Rientjes 2012-07-31 400 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki