All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Boaz Harrosh <boaz@plexistor.com>,
	Dave Chinner <david@fromorbit.com>,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-nvdimm <linux-nvdimm@ml01.01.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Eryu Guan <eguan@redhat.com>
Subject: Re: [PATCH 1/3] mm: New pfn_mkwrite same as page_mkwrite for VM_PFNMAP
Date: Wed, 25 Mar 2015 17:13:54 +0200	[thread overview]
Message-ID: <20150325151354.GA12387@node.dhcp.inet.fi> (raw)
In-Reply-To: <5512CF68.5040509@intel.com>

On Wed, Mar 25, 2015 at 08:08:24AM -0700, Dave Hansen wrote:
> On 03/25/2015 06:38 AM, Boaz Harrosh wrote:
> >  /*
> >   * This routine handles present pages, when users try to write
> >   * to a shared page. It is done by copying the page to a new address
> > @@ -2025,8 +2042,17 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
> >  		 * accounting on raw pfn maps.
> >  		 */
> >  		if ((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
> > -				     (VM_WRITE|VM_SHARED))
> > +				     (VM_WRITE|VM_SHARED)) {
> > +			pte_unmap_unlock(page_table, ptl);
> > +			ret = do_pfn_mkwrite(vma, address);
> > +			if (ret & VM_FAULT_ERROR)
> > +				return ret;
> > +			page_table = pte_offset_map_lock(mm, pmd, address,
> > +							 &ptl);
> > +			if (!pte_same(*page_table, orig_pte))
> > +				goto unlock;
> >  			goto reuse;
> > +		}
> >  		goto gotten;
> >  	}
> 
> This adds a lock release/reacquire in a place where the lock was
> previously just held.  Could you explain a bit why this is safe?

It's common practice in page fault codepath. See code around
->page_mkwrite for example.
> 
> Also, that pte_same() check looks a bit fragile.  It seems like it would
> fail if the hardware, for instance, set the accessed bit in here
> somewhere.  Is that what we want?

In this case we will cancel this fault handling and fault again. No
problems here.

-- 
 Kirill A. Shutemov

--
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:[~2015-03-25 15:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 13:34 [PATCH 0/3 v4] dax: some dax fixes and cleanups Boaz Harrosh
2015-03-25 13:34 ` Boaz Harrosh
2015-03-25 13:38 ` [PATCH 1/3] mm: New pfn_mkwrite same as page_mkwrite for VM_PFNMAP Boaz Harrosh
2015-03-25 14:34   ` Kirill A. Shutemov
2015-03-26  7:49     ` Boaz Harrosh
2015-03-25 15:08   ` Dave Hansen
2015-03-25 15:13     ` Kirill A. Shutemov [this message]
2015-03-25 13:41 ` [PATCH 2/3] dax: pfn_mkwrite update c/mtime + freeze protection Boaz Harrosh
2015-03-25 13:41   ` Boaz Harrosh
2015-03-25 13:44 ` [PATCH 3/3] dax: Unify ext2/4_{dax,}_file_operations Boaz Harrosh
2015-03-25 13:44   ` Boaz Harrosh
2015-03-25 13:47 ` [FIXME] NOT-GOOD: dax: dax_prepare_freeze Boaz Harrosh
2015-03-25 13:47   ` Boaz Harrosh
  -- strict thread matches above, loose matches on Subject: below --
2015-03-23 12:47 [PATCH 0/3 v3] dax: Fix mmap-write not updating c/mtime Boaz Harrosh
2015-03-23 12:49 ` [PATCH 1/3] mm: New pfn_mkwrite same as page_mkwrite for VM_PFNMAP Boaz Harrosh
2015-03-23 22:49   ` Andrew Morton
2015-03-23 22:49     ` Andrew Morton

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=20150325151354.GA12387@node.dhcp.inet.fi \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=boaz@plexistor.com \
    --cc=dave.hansen@intel.com \
    --cc=david@fromorbit.com \
    --cc=eguan@redhat.com \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=matthew.r.wilcox@intel.com \
    --cc=mgorman@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.