linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Dave Hansen <dave.hansen@intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Hugh Dickins <hughd@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Christoph Lameter <cl@gentwo.org>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Jerome Marchand <jmarchan@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 3/9] mm: postpone page table allocation until do_set_pte()
Date: Tue, 1 Dec 2015 23:04:11 +0200	[thread overview]
Message-ID: <20151201210411.GB135984@black.fi.intel.com> (raw)
In-Reply-To: <565E08C5.8090607@intel.com>

On Tue, Dec 01, 2015 at 12:53:25PM -0800, Dave Hansen wrote:
> On 11/18/2015 03:25 PM, Kirill A. Shutemov wrote:
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -2068,11 +2068,6 @@ void filemap_map_pages(struct fault_env *fe,
> ...
> >  		if (file->f_ra.mmap_miss > 0)
> >  			file->f_ra.mmap_miss--;
> > -		do_set_pte(fe, page);
> > +
> > +		fe->address += (iter.index - last_pgoff) << PAGE_SHIFT;
> > +		if (fe->pte)
> > +			fe->pte += iter.index - last_pgoff;
> > +		last_pgoff = iter.index;
> > +		if (do_set_pte(fe, NULL, page)) {
> > +			/* failed to setup page table: giving up */
> > +			if (!fe->pte)
> > +				break;
> > +			goto unlock;
> > +		}
> >  		unlock_page(page);
> >  		goto next;
> 
> Hey Kirill,
> 
> Is there a case here where do_set_pte() returns an error and _still_
> manages to populate fe->pte?

Yes. If the page is already mapped, we will get VM_FAULT_NOPAGE:

do_set_pte()
  pte_alloc_one_map()
    !pmd_none(*fe->pmd) => goto map_pte;
    fe->pte = pte_offset_map_lock()
  !pte_none(*fe->pte) => return VM_FAULT_NOPAGE;

-- 
 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-12-01 21:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 23:25 [PATCH 0/9] RFD: huge tmpfs: compound vs. team pages Kirill A. Shutemov
2015-11-18 23:25 ` [PATCH 1/9] mm: do not pass mm_struct into handle_mm_fault Kirill A. Shutemov
2015-11-18 23:25 ` [PATCH 2/9] mm: introduce fault_env Kirill A. Shutemov
2015-11-19 11:36   ` Peter Zijlstra
2015-11-18 23:25 ` [PATCH 3/9] mm: postpone page table allocation until do_set_pte() Kirill A. Shutemov
2015-12-01 20:53   ` Dave Hansen
2015-12-01 21:04     ` Kirill A. Shutemov [this message]
2015-11-18 23:25 ` [PATCH 4/9] mm: introduce do_set_pmd() Kirill A. Shutemov
2015-11-18 23:25 ` [PATCH 5/9] radix-tree: implement radix_tree_maybe_preload_order() Kirill A. Shutemov
2015-11-18 23:25 ` [PATCH 6/9] rmap: support file THP Kirill A. Shutemov
2015-12-01 20:56   ` Dave Hansen
2015-12-16 12:00     ` Kirill A. Shutemov
2015-11-18 23:25 ` [PATCH 7/9] thp: support file pages in zap_huge_pmd() Kirill A. Shutemov
2015-11-18 23:25 ` [PATCH 8/9] thp: handle file pages in split_huge_pmd() Kirill A. Shutemov
2015-11-18 23:25 ` [PATCH 9/9] WIP: shmem: add huge pages support Kirill A. Shutemov

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=20151201210411.GB135984@black.fi.intel.com \
    --to=kirill@shutemov.name \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=dave.hansen@intel.com \
    --cc=hughd@google.com \
    --cc=jmarchan@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).