[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 2 Feb 2009 23:10:42 +0900 (JST)
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Hugh Dickins <hugh@...itas.com>
Cc: kosaki.motohiro@...fujitsu.com,
Linus Torvalds <torvalds@...ux-foundation.org>,
Lee Schermerhorn <Lee.Schermerhorn@...com>,
Greg KH <gregkh@...e.de>,
Maksim Yevmenkin <maksim.yevmenkin@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Nick Piggin <npiggin@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
will@...wder-design.com, Rik van Riel <riel@...hat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Mikos Szeredi <miklos@...redi.hu>,
Andy Whitcroft <apw@...onical.com>, Mel Gorman <mel@....ul.ie>
Subject: Re: [PATCH] Fix OOPS in mmap_region() when merging adjacent VM_LOCKED file segments
(cc to mel)
> On Mon, 2 Feb 2009, KOSAKI Motohiro wrote:
> > >
> > > - if (flags & MAP_NORESERVE)
> > > + /*
> > > + * Set 'VM_NORESERVE' if we should not account for the
> > > + * memory use of this mapping. We only honor MAP_NORESERVE
> > > + * if we're allowed to overcommit memory.
> > > + */
> > > + if ((flags & MAP_NORESERVE) && sysctl_overcommit_memory != OVERCOMMIT_NEVER)
> >
> > I afraid this line a bit.
> > if following scenario happend, we can lost VM_NORESERVE?
> >
> > 1. admin set overcommit_memory to "never"
> > 2. mmap
> > 3. admin set overcommit_memory to "guess"
>
> I still haven't reviewed it fully myself (and note that what
> Linus put in his tree is not identical to this posted patch),
> but I do believe this is okay.
>
> When admin changes overcommit_memory, we don't make a pass across
> every vma of every mm in the system, to adjust all the accounting
> of VM_NORESERVE areas; so I think it's quite reasonable to take
> VM_NORESERVE as reflecting the policy in force when that vma was
> created. And nothing is displaying the VM_NORESERVE flag.
hmhm, I see.
> Ah, you're actually thinking of
> 4. mprotect
> with the original flags (!VM_WRITE) such that no VM_ACCOUNT was done,
> and now VM_WRITE is added and the accounting is done despite it having
> been mapped MAP_NORESERVE originally. Whereas before Linus's change,
> VM_NORESERVE would have still exempted it.
>
> Well... I don't think I care!
Yeah.
FWIW, we don't need VM_NORESERVE checking now because VM_NORESERVE and VM_ACCOUNT
are exclusive condition now :)
> But I wonder what the hugetlb situation is: that
> if (!accountable)
> vm_flags |= VM_NORESERVE;
> looks suspicious to me, they look as if they're exempting all
> the hugetlb pages from its accounting, whereas !accountable was
> only supposed to exempt them from mmap_region()'s own accounting.
HAHAHA, Indeed.
when hugepage shared read-only mapping -> hugepage shared writable maping,
following code seems to cause calling vm_enough_memory() although hugepage.
========================================================
mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
unsigned long start, unsigned long end, unsigned long newflags)
{
if (newflags & VM_WRITE) {
if (!(oldflags & (VM_ACCOUNT|VM_WRITE|
VM_SHARED|VM_NORESERVE))) {
charged = nrpages;
if (security_vm_enough_memory(charged))
return -ENOMEM;
newflags |= VM_ACCOUNT;
}
}
==========================================================
mel, what do you think this?
>
> Perhaps. I'm still looking at other things,
> not given this the time it needs yet.
>
> Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists