[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20091218150648.09276f83.kamezawa.hiroyu@jp.fujitsu.com>
Date: Fri, 18 Dec 2009 15:06:48 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: Minchan Kim <minchan.kim@...il.com>
Cc: Andi Kleen <andi@...stfloor.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>, cl@...ux-foundation.org,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"mingo@...e.hu" <mingo@...e.hu>
Subject: Re: [RFC 4/4] speculative pag fault
On Fri, 18 Dec 2009 14:54:49 +0900
Minchan Kim <minchan.kim@...il.com> wrote:
> Hi, Kame.
>
Hi,
> On Fri, 18 Dec 2009 09:46:02 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> > if (flags & FAULT_FLAG_WRITE) {
> > if (!pte_write(entry))
> >
>
> I looked over the patch series and come up to one scenario.
>
> CPU A CPU 2
>
> "Thread A reads page"
>
> do_page_fault
> lookup_vma_cache
> vma->cache_access++
> "Thread B unmap the vma"
>
> mm_write_lock
> down_write(mm->mmap_sem)
> mm->version++
> do_munmap
> wait_vmas_cache_access
> wait_event_interruptible
> mm_version_check fail
> vma_release
> wake_up(vma->cache_wait)
> unmap_region
> mm_write_unlock
> mm_read_trylock
> find_vma
> !vma
> bad_area
>
> As above scenario, Apparently, Thread A reads proper page in the vma at that time.
> but it would meet the segment fault by speculative page fault.
>
Yes, It's intentional.
> Sorry that i don't have time to review more detail.
ya, take it easy. I'm not in hurry.
> If I miss something, Pz correct me.
>
In multi-threaded application, mutual-exclusion of memory-access v.s. munmap
is the application's job. In above case, the application shouldn't unmap memory
while it's access memory. (The application can be preempted at any point.)
So, the kernel only have to take care of sanity of memory map status.
In this case, no error in kernel's object. This is correct.
Thank you for your interests.
Regards,
-Kame
--
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