linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Michal Hocko <mhocko@kernel.org>,
	David Rientjes <rientjes@google.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH] mm, oom: don't invoke oom killer if current has been reapered
Date: Tue, 14 Jul 2020 13:03:23 +0800	[thread overview]
Message-ID: <CALOAHbAmk+5sxxKULqiPE4F5EGZHmvD6Nm+uZyVu=YC2Tj+Vbw@mail.gmail.com> (raw)
In-Reply-To: <9b9c8510-1a1d-86b0-59ce-29992a53d52c@i-love.sakura.ne.jp>

On Tue, Jul 14, 2020 at 12:06 PM Tetsuo Handa
<penguin-kernel@i-love.sakura.ne.jp> wrote:
>
> On 2020/07/14 11:58, Yafang Shao wrote:
> > On Tue, Jul 14, 2020 at 10:42 AM Tetsuo Handa
> > <penguin-kernel@i-love.sakura.ne.jp> wrote:
> >>
> >> On 2020/07/14 11:13, Yafang Shao wrote:
> >>> But it seems the proposal that using trylock in
> >>> mem_cgroup_out_of_memory() should  be better?
> >>> The trylock could also solve the problem that different processes are
> >>> doing oom at the same time.
> >>
> >> I think trylock is worse. The trylock needlessly wastes CPU time which could
> >> have been utilized by the OOM killer/reaper for reclaiming memory.
> >
> > If it may wastes the CPU time, we can shed it out for 1 second like
> > what it does in __alloc_pages_may_oom():
> >
> > __alloc_pages_may_oom
> >     if (!mutex_trylock(&oom_lock)) {
> >         schedule_timeout_uninterruptible(1);  // to avoid wasting CPU time
>
> 1 second is HZ. 1 means 1 millisecond if CONFIG_HZ=1000. :-)
>

Right. Thanks for pointing it out :)

> >         return;
> >     }
> >
> > But I find that we doesn't sched it out in pagefault path,
> >
> > pagefault_out_of_memory
> >     if (!mutex_trylock(&oom_lock))
> >         return;
> >
> > I haven't thought deeply what the difference is ...
>
> David Rientjes is proposing it for avoiding soft lockup, and Michal Hocko is refusing it.
> How to give the OOM killer/reaper enough CPU time for reclaiming memory is a dogfight. :-(
>
> https://lkml.kernel.org/r/alpine.DEB.2.21.2003181458100.70237@chino.kir.corp.google.com

OK. I will take a look at the discussion in that thread.

-- 
Thanks
Yafang


  reply	other threads:[~2020-07-14  5:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11  3:18 Yafang Shao
2020-07-11  5:37 ` Yafang Shao
2020-07-13  6:01 ` Michal Hocko
2020-07-13  6:21   ` Michal Hocko
2020-07-13 12:24     ` Yafang Shao
2020-07-13 12:45       ` Michal Hocko
2020-07-13 13:11         ` Yafang Shao
2020-07-13 19:05           ` Michal Hocko
2020-07-14  0:15             ` Tetsuo Handa
2020-07-14  0:18               ` Tetsuo Handa
2020-07-14  2:09             ` Yafang Shao
2020-07-13 23:50 ` Tetsuo Handa
2020-07-14  2:13   ` Yafang Shao
2020-07-14  2:42     ` Tetsuo Handa
2020-07-14  2:58       ` Yafang Shao
2020-07-14  4:06         ` Tetsuo Handa
2020-07-14  5:03           ` Yafang Shao [this message]
2020-07-14  6:51           ` Michal Hocko
2020-07-14  6:43   ` Michal Hocko
2020-07-14  9:30     ` Yafang Shao

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='CALOAHbAmk+5sxxKULqiPE4F5EGZHmvD6Nm+uZyVu=YC2Tj+Vbw@mail.gmail.com' \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rientjes@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox