From: kbuild test robot <lkp@intel.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: kbuild-all@01.org, linux-mm@kvack.org,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH 2/2] memcg: do not report racy no-eligible OOM tasks
Date: Tue, 8 Jan 2019 16:35:42 +0800 [thread overview]
Message-ID: <201901081642.Q6tXklr0%fengguang.wu@intel.com> (raw)
In-Reply-To: <20190107143802.16847-3-mhocko@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 8106 bytes --]
Hi Michal,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.0-rc1 next-20190108]
[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/oom-memcg-do-not-report-racy-no-eligible-OOM/20190108-092805
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
include/linux/rcupdate.h:659:9: warning: context imbalance in 'find_lock_task_mm' - wrong count at exit
include/linux/sched/mm.h:141:37: warning: dereference of noderef expression
mm/oom_kill.c:225:28: warning: context imbalance in 'oom_badness' - unexpected unlock
mm/oom_kill.c:406:9: warning: context imbalance in 'dump_tasks' - different lock contexts for basic block
>> mm/oom_kill.c:918:17: warning: context imbalance in '__oom_kill_process' - unexpected unlock
vim +/__oom_kill_process +918 mm/oom_kill.c
1af8bb43 Michal Hocko 2016-07-28 845
5989ad7b Roman Gushchin 2018-08-21 846 static void __oom_kill_process(struct task_struct *victim)
^1da177e Linus Torvalds 2005-04-16 847 {
5989ad7b Roman Gushchin 2018-08-21 848 struct task_struct *p;
647f2bdf David Rientjes 2012-03-21 849 struct mm_struct *mm;
bb29902a Tetsuo Handa 2016-03-25 850 bool can_oom_reap = true;
^1da177e Linus Torvalds 2005-04-16 851
6b0c81b3 David Rientjes 2012-07-31 852 p = find_lock_task_mm(victim);
6b0c81b3 David Rientjes 2012-07-31 853 if (!p) {
6b0c81b3 David Rientjes 2012-07-31 854 put_task_struct(victim);
647f2bdf David Rientjes 2012-03-21 855 return;
6b0c81b3 David Rientjes 2012-07-31 856 } else if (victim != p) {
6b0c81b3 David Rientjes 2012-07-31 857 get_task_struct(p);
6b0c81b3 David Rientjes 2012-07-31 858 put_task_struct(victim);
6b0c81b3 David Rientjes 2012-07-31 859 victim = p;
6b0c81b3 David Rientjes 2012-07-31 860 }
647f2bdf David Rientjes 2012-03-21 861
880b7689 Tetsuo Handa 2015-11-05 862 /* Get a reference to safely compare mm after task_unlock(victim) */
647f2bdf David Rientjes 2012-03-21 863 mm = victim->mm;
f1f10076 Vegard Nossum 2017-02-27 864 mmgrab(mm);
8e675f7a Konstantin Khlebnikov 2017-07-06 865
8e675f7a Konstantin Khlebnikov 2017-07-06 866 /* Raise event before sending signal: task reaper must see this */
8e675f7a Konstantin Khlebnikov 2017-07-06 867 count_vm_event(OOM_KILL);
fe6bdfc8 Roman Gushchin 2018-06-14 868 memcg_memory_event_mm(mm, MEMCG_OOM_KILL);
8e675f7a Konstantin Khlebnikov 2017-07-06 869
426fb5e7 Tetsuo Handa 2015-11-05 870 /*
cd04ae1e Michal Hocko 2017-09-06 871 * We should send SIGKILL before granting access to memory reserves
cd04ae1e Michal Hocko 2017-09-06 872 * in order to prevent the OOM victim from depleting the memory
cd04ae1e Michal Hocko 2017-09-06 873 * reserves from the user space under its control.
426fb5e7 Tetsuo Handa 2015-11-05 874 */
079b22dc Eric W. Biederman 2018-09-03 875 do_send_sig_info(SIGKILL, SEND_SIG_PRIV, victim, PIDTYPE_TGID);
16e95196 Johannes Weiner 2015-06-24 876 mark_oom_victim(victim);
eca56ff9 Jerome Marchand 2016-01-14 877 pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n",
647f2bdf David Rientjes 2012-03-21 878 task_pid_nr(victim), victim->comm, K(victim->mm->total_vm),
647f2bdf David Rientjes 2012-03-21 879 K(get_mm_counter(victim->mm, MM_ANONPAGES)),
eca56ff9 Jerome Marchand 2016-01-14 880 K(get_mm_counter(victim->mm, MM_FILEPAGES)),
eca56ff9 Jerome Marchand 2016-01-14 881 K(get_mm_counter(victim->mm, MM_SHMEMPAGES)));
647f2bdf David Rientjes 2012-03-21 882 task_unlock(victim);
647f2bdf David Rientjes 2012-03-21 883
647f2bdf David Rientjes 2012-03-21 884 /*
647f2bdf David Rientjes 2012-03-21 885 * Kill all user processes sharing victim->mm in other thread groups, if
647f2bdf David Rientjes 2012-03-21 886 * any. They don't get access to memory reserves, though, to avoid
647f2bdf David Rientjes 2012-03-21 887 * depletion of all memory. This prevents mm->mmap_sem livelock when an
647f2bdf David Rientjes 2012-03-21 888 * oom killed thread cannot exit because it requires the semaphore and
647f2bdf David Rientjes 2012-03-21 889 * its contended by another thread trying to allocate memory itself.
647f2bdf David Rientjes 2012-03-21 890 * That thread will now get access to memory reserves since it has a
647f2bdf David Rientjes 2012-03-21 891 * pending fatal signal.
647f2bdf David Rientjes 2012-03-21 892 */
4d4048be Oleg Nesterov 2014-01-21 893 rcu_read_lock();
c319025a Oleg Nesterov 2015-11-05 894 for_each_process(p) {
00508538 Michal Hocko 2019-01-07 895 struct task_struct *t;
4d7b3394 Oleg Nesterov 2015-11-05 896 if (!process_shares_mm(p, mm))
c319025a Oleg Nesterov 2015-11-05 897 continue;
c319025a Oleg Nesterov 2015-11-05 898 if (same_thread_group(p, victim))
c319025a Oleg Nesterov 2015-11-05 899 continue;
1b51e65e Michal Hocko 2016-10-07 900 if (is_global_init(p)) {
aac45363 Michal Hocko 2016-03-25 901 can_oom_reap = false;
862e3073 Michal Hocko 2016-10-07 902 set_bit(MMF_OOM_SKIP, &mm->flags);
a373966d Michal Hocko 2016-07-28 903 pr_info("oom killer %d (%s) has mm pinned by %d (%s)\n",
a373966d Michal Hocko 2016-07-28 904 task_pid_nr(victim), victim->comm,
a373966d Michal Hocko 2016-07-28 905 task_pid_nr(p), p->comm);
647f2bdf David Rientjes 2012-03-21 906 continue;
aac45363 Michal Hocko 2016-03-25 907 }
1b51e65e Michal Hocko 2016-10-07 908 /*
1b51e65e Michal Hocko 2016-10-07 909 * No use_mm() user needs to read from the userspace so we are
1b51e65e Michal Hocko 2016-10-07 910 * ok to reap it.
1b51e65e Michal Hocko 2016-10-07 911 */
1b51e65e Michal Hocko 2016-10-07 912 if (unlikely(p->flags & PF_KTHREAD))
1b51e65e Michal Hocko 2016-10-07 913 continue;
079b22dc Eric W. Biederman 2018-09-03 914 do_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_TGID);
00508538 Michal Hocko 2019-01-07 915 t = find_lock_task_mm(p);
00508538 Michal Hocko 2019-01-07 916 if (!t)
00508538 Michal Hocko 2019-01-07 917 continue;
00508538 Michal Hocko 2019-01-07 @918 mark_oom_victim(t);
00508538 Michal Hocko 2019-01-07 919 task_unlock(t);
647f2bdf David Rientjes 2012-03-21 920 }
6b0c81b3 David Rientjes 2012-07-31 921 rcu_read_unlock();
647f2bdf David Rientjes 2012-03-21 922
aac45363 Michal Hocko 2016-03-25 923 if (can_oom_reap)
36324a99 Michal Hocko 2016-03-25 924 wake_oom_reaper(victim);
aac45363 Michal Hocko 2016-03-25 925
880b7689 Tetsuo Handa 2015-11-05 926 mmdrop(mm);
6b0c81b3 David Rientjes 2012-07-31 927 put_task_struct(victim);
^1da177e Linus Torvalds 2005-04-16 928 }
647f2bdf David Rientjes 2012-03-21 929 #undef K
^1da177e Linus Torvalds 2005-04-16 930
:::::: The code at line 918 was first introduced by commit
:::::: 00508538cb045f28a2f60e5d2dff98b77b0da725 mm, oom: marks all killed tasks as oom victims
:::::: TO: Michal Hocko <mhocko@suse.com>
:::::: CC: 0day robot <lkp@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67238 bytes --]
next prev parent reply other threads:[~2019-01-08 8:51 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 14:38 [PATCH 0/2] oom, memcg: do not report racy no-eligible OOM Michal Hocko
2019-01-07 14:38 ` Michal Hocko
2019-01-07 14:38 ` [PATCH 1/2] mm, oom: marks all killed tasks as oom victims Michal Hocko
2019-01-07 14:38 ` Michal Hocko
2019-01-07 20:58 ` Tetsuo Handa
2019-01-08 8:11 ` Michal Hocko
2019-01-07 14:38 ` [PATCH 2/2] memcg: do not report racy no-eligible OOM tasks Michal Hocko
2019-01-07 14:38 ` Michal Hocko
2019-01-07 20:59 ` Tetsuo Handa
2019-01-08 8:14 ` Michal Hocko
2019-01-08 10:39 ` Tetsuo Handa
2019-01-08 11:46 ` Michal Hocko
2019-01-08 8:35 ` kbuild test robot [this message]
2019-01-08 9:39 ` Michal Hocko
2019-01-11 0:23 ` [kbuild-all] " Rong Chen
2019-01-08 14:21 ` [PATCH 3/2] memcg: Facilitate termination of memcg OOM victims Tetsuo Handa
2019-01-08 14:38 ` Michal Hocko
2019-01-09 11:03 ` [PATCH 0/2] oom, memcg: do not report racy no-eligible OOM Michal Hocko
2019-01-09 11:34 ` Tetsuo Handa
2019-01-09 12:02 ` Michal Hocko
2019-01-10 23:59 ` Tetsuo Handa
2019-01-11 10:25 ` Tetsuo Handa
2019-01-11 11:33 ` Michal Hocko
2019-01-11 12:40 ` Tetsuo Handa
2019-01-11 13:34 ` Michal Hocko
2019-01-11 14:31 ` Tetsuo Handa
2019-01-11 15:07 ` Michal Hocko
2019-01-11 15:37 ` Tetsuo Handa
2019-01-11 16:45 ` Michal Hocko
2019-01-12 10:52 ` Tetsuo Handa
2019-01-13 17:36 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201901081642.Q6tXklr0%fengguang.wu@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.