linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Minchan Kim <minchan.kim@gmail.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Norbert Preining <preining@logic.at>,
	linux-kernel@vger.kernel.org, linux-mm <linux-mm@kvack.org>
Subject: Re: OOM killer, page fault
Date: Tue, 3 Nov 2009 08:28:29 +0900	[thread overview]
Message-ID: <20091103082829.db0b1e33.minchan.kim@barrios-desktop> (raw)
In-Reply-To: <Pine.LNX.4.64.0911021556020.12937@sister.anvils>

Hi, Hugh. 

On Mon, 2 Nov 2009 16:26:56 +0000 (GMT)
Hugh Dickins <hugh.dickins@tiscali.co.uk> wrote:

> On Mon, 2 Nov 2009, Minchan Kim wrote:
> > On Mon, 2 Nov 2009 14:02:16 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > > 
> > > Maybe some code returns VM_FAULT_OOM by mistake and pagefault_oom_killer()
> > > is called. digging mm/memory.c is necessary...
> > > 
> > > I wonder why...now is this code
> > > ===
> > > static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
> > >                 unsigned long address, pte_t *page_table, pmd_t *pmd,
> > >                 unsigned int flags, pte_t orig_pte)
> > > {
> > >         pgoff_t pgoff;
> > > 
> > >         flags |= FAULT_FLAG_NONLINEAR;
> > > 
> > > 	if (!pte_unmap_same(mm, pmd, page_table, orig_pte))
> > >                 return 0;
> > > 
> > >         if (unlikely(!(vma->vm_flags & VM_NONLINEAR))) {
> > >                 /*
> > >                  * Page table corrupted: show pte and kill process.
> > >                  */
> > >                 print_bad_pte(vma, address, orig_pte, NULL);
> > >                 return VM_FAULT_OOM;
> > >         }
> > > 
> > >         pgoff = pte_to_pgoff(orig_pte);
> > >         return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);
> > > }
> > > ==
> > > Then, OOM...is this really OOM ?
> > 
> > It seems that the goal is to kill process by OOM trick as comment said.
> > 
> > I found It results from Hugh's commit 65500d234e74fc4e8f18e1a429bc24e51e75de4a.
> > I think it's not a real OOM. 
> > 
> > BTW, If it is culpit in this case, print_bad_pte should have remained any log. :)
> 
> Yes, the chances are that this is not related to Norbert's problem.
> But thank you for reminding me of that not-very-nice hack of mine.
> 
> It was kind-of valid at the time that I wrote it (2.6.15), when
> VM_FAULT_OOM did kill the faulting process.  But since then the fault
> path has rightly been changed (in x86 at least, I didn't check the rest)
> to let the OOM killer decide who to kill: so now there's a danger that
> a pagetable corruption there will instead kill some unrelated process.
> 
> Being lazy, I'm inclined simply to change that to VM_FAULT_SIGBUS now:
> which doesn't actually guarantee that the process will be killed, but
> should be better than just repeatedly re-faulting on the entry.  (I
> don't much want to SIGKILL current since mm might not be current's.)
> 
> That aberrant use of VM_FAULT_OOM has recently been copied into
> do_swap_page() (the first instance; the second instance is right -
> hmm, well, the second instance is normally right, but I guess it
> also covers pagetable corruption cases which we can't distinguish
> there; oh well) and should be corrected there too.
> 
> Does VM_FAULT_SIGBUS sound good enough to you?

I am Okay. 
First of all, we have to prevent innocent process killing.
Second, although it returns SIGBUS, we can distinguish it from normal SIGBUS
by bad pte log.
Third, we don't want to add new VM_FAULT_XXX as possible as. :)


> 
> Hugh


-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-11-02 23:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091030063216.GA30712@gamma.logic.tuwien.ac.at>
2009-11-02  4:24 ` KOSAKI Motohiro
2009-11-02  4:56   ` Minchan Kim
2009-11-02  5:02     ` KAMEZAWA Hiroyuki
2009-11-02  6:01       ` Minchan Kim
2009-11-02 16:26         ` Hugh Dickins
2009-11-02 23:28           ` Minchan Kim [this message]
2009-11-02  6:35       ` Minchan Kim
2009-11-02 14:19       ` Norbert Preining
2009-11-02 14:40         ` Minchan Kim
2009-11-05 13:21           ` Norbert Preining
2009-11-05 15:19             ` Minchan Kim
2009-11-05 15:26               ` Norbert Preining
2009-11-05 16:16                 ` Norbert Preining
2009-11-05 20:37             ` Jody Belka
2009-11-05 22:18               ` Minchan Kim
2009-11-06  0:01                 ` Norbert Preining
2009-11-06 13:38                   ` Norbert Preining
2009-11-06 15:14                     ` Minchan Kim
2009-11-06 15:18                       ` Norbert Preining
2009-11-02  6:59     ` KOSAKI Motohiro
2009-11-02  7:00       ` Minchan Kim

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=20091103082829.db0b1e33.minchan.kim@barrios-desktop \
    --to=minchan.kim@gmail.com \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=preining@logic.at \
    /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