Re: [PATCH v8] oom_kill.c: futex: Don't OOM reap the VMA containing the robust_list_head
From: kernel test robot
Date: Fri Apr 08 2022 - 10:41:45 EST
Hi Nico,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hnaz-mm/master]
[also build test WARNING on linus/master v5.18-rc1 next-20220408]
[cannot apply to linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Nico-Pache/oom_kill-c-futex-Don-t-OOM-reap-the-VMA-containing-the-robust_list_head/20220408-112952
base: https://github.com/hnaz/linux-mm master
config: x86_64-randconfig-s022 (https://download.01.org/0day-ci/archive/20220408/202204082258.E7EPbAYz-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/intel-lab-lkp/linux/commit/70c1e2a404ac47b7c9b8bd1e9c4d3e72f19e6c62
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Nico-Pache/oom_kill-c-futex-Don-t-OOM-reap-the-VMA-containing-the-robust_list_head/20220408-112952
git checkout 70c1e2a404ac47b7c9b8bd1e9c4d3e72f19e6c62
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> mm/oom_kill.c:606:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *robust_list @@ got struct robust_list_head [noderef] __user *robust_list @@
mm/oom_kill.c:606:21: sparse: expected void *robust_list
mm/oom_kill.c:606:21: sparse: got struct robust_list_head [noderef] __user *robust_list
mm/oom_kill.c: note: in included file (through include/linux/rculist.h, include/linux/sched/signal.h, include/linux/oom.h):
include/linux/rcupdate.h:726:9: sparse: sparse: context imbalance in 'find_lock_task_mm' - wrong count at exit
mm/oom_kill.c:222:28: sparse: sparse: context imbalance in 'oom_badness' - unexpected unlock
include/linux/rcupdate.h:726:9: sparse: sparse: context imbalance in 'dump_task' - unexpected unlock
include/linux/rcupdate.h:726:9: sparse: sparse: context imbalance in '__oom_kill_process' - unexpected unlock
mm/oom_kill.c:1243:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *robust_list @@ got struct robust_list_head [noderef] __user *robust_list @@
mm/oom_kill.c:1243:21: sparse: expected void *robust_list
mm/oom_kill.c:1243:21: sparse: got struct robust_list_head [noderef] __user *robust_list
mm/oom_kill.c:1232:20: sparse: sparse: context imbalance in '__se_sys_process_mrelease' - unexpected unlock
--
>> mm/mmap.c:3138:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *robust_list @@ got struct robust_list_head [noderef] __user *robust_list @@
mm/mmap.c:3138:21: sparse: expected void *robust_list
mm/mmap.c:3138:21: sparse: got struct robust_list_head [noderef] __user *robust_list
vim +606 mm/oom_kill.c
575
576 /*
577 * Reaps the address space of the give task.
578 *
579 * Returns true on success and false if none or part of the address space
580 * has been reclaimed and the caller should retry later.
581 */
582 static bool oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)
583 {
584 bool ret = true;
585 void *robust_list = NULL;
586
587 if (!mmap_read_trylock(mm)) {
588 trace_skip_task_reaping(tsk->pid);
589 return false;
590 }
591
592 /*
593 * MMF_OOM_SKIP is set by exit_mmap when the OOM reaper can't
594 * work on the mm anymore. The check for MMF_OOM_SKIP must run
595 * under mmap_lock for reading because it serializes against the
596 * mmap_write_lock();mmap_write_unlock() cycle in exit_mmap().
597 */
598 if (test_bit(MMF_OOM_SKIP, &mm->flags)) {
599 trace_skip_task_reaping(tsk->pid);
600 goto out_unlock;
601 }
602
603 trace_start_task_reaping(tsk->pid);
604
605 #ifdef CONFIG_FUTEX
> 606 robust_list = tsk->robust_list;
607 #endif
608 /* failed to reap part of the address space. Try again later */
609 ret = __oom_reap_task_mm(mm, robust_list);
610 if (!ret)
611 goto out_finish;
612
613 pr_info("oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n",
614 task_pid_nr(tsk), tsk->comm,
615 K(get_mm_counter(mm, MM_ANONPAGES)),
616 K(get_mm_counter(mm, MM_FILEPAGES)),
617 K(get_mm_counter(mm, MM_SHMEMPAGES)));
618 out_finish:
619 trace_finish_task_reaping(tsk->pid);
620 out_unlock:
621 mmap_read_unlock(mm);
622
623 return ret;
624 }
625
--
0-DAY CI Kernel Test Service
https://01.org/lkp