linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: Minchan Kim <minchan@kernel.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>, Rik van Riel <riel@surriel.com>,
	Mel Gorman <mgorman@techsingularity.net>
Subject: Re: [PATCH] mm: write protect MADV_FREE pages
Date: Wed, 25 Jan 2017 17:50:06 -0800	[thread overview]
Message-ID: <20170126015006.2ft2vi3evkkjxw7i@kernel.org> (raw)
In-Reply-To: <20170125230909.GA20811@bbox>

On Thu, Jan 26, 2017 at 08:09:09AM +0900, Minchan Kim wrote:
> Hello,
> 
> On Wed, Jan 25, 2017 at 09:15:19AM -0800, Shaohua Li wrote:
> > On Tue, Jan 24, 2017 at 11:32:12AM +0900, Minchan Kim wrote:
> > > Hi Shaohua,
> > > 
> > > On Mon, Jan 23, 2017 at 03:15:52PM -0800, Shaohua Li wrote:
> > > > The page reclaim has an assumption writting to a page with clean pte
> > > > should trigger a page fault, because there is a window between pte zero
> > > > and tlb flush where a new write could come. If the new write doesn't
> > > > trigger page fault, page reclaim will not notice it and think the page
> > > > is clean and reclaim it. The MADV_FREE pages don't comply with the rule
> > > > and the pte is just cleaned without writeprotect, so there will be no
> > > > pagefault for new write. This will cause data corruption.
> > > 
> > > It's hard to understand.
> > > Could you show me exact scenario seqence you have in mind?
> > Sorry for the delay, for some reason, I didn't receive the mail.
> > in try_to_unmap_one:
> > CPU 1:						CPU2:
> > 1. pteval = ptep_get_and_clear(mm, address, pte);
> > 2.						write to the address
> > 3. tlb flush
> > 
> > step 1 will get a clean pteval, step2 dirty it, but the unmap missed the dirty
> > bit so discard the page without pageout. step2 doesn't trigger a page fault,
> 
> I thought about that when Mel introduced deferred flush and concluded it
> should be no problem from theses discussion:
>  
> 1. https://lkml.org/lkml/2015/4/15/565
> 2. https://lkml.org/lkml/2015/4/16/136
> 
> So, shouldn't it make trap?
> 
> Ccing Mel.

Ah, don't know the cpu will refetch and trigger the fault. Thanks for the
clarification.

Thanks,
Shaohua

--
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:[~2017-01-26  1:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 23:15 Shaohua Li
2017-01-23 23:28 ` Andrew Morton
2017-01-24  0:01   ` Shaohua Li
2017-01-24  2:32 ` Minchan Kim
2017-01-25 17:15   ` Shaohua Li
2017-01-25 23:09     ` Minchan Kim
2017-01-26  1:50       ` Shaohua Li [this message]

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=20170126015006.2ft2vi3evkkjxw7i@kernel.org \
    --to=shli@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=minchan@kernel.org \
    --cc=riel@surriel.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