Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281211 > unrolled thread

Re: [PATCH 3/9] mm: postpone page table allocation until do_set_pte()

Started byDave Hansen <dave.hansen@intel.com>
First post2015-12-01 22:00 +0100
Last post2015-12-01 22:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 3/9] mm: postpone page table allocation until do_set_pte() Dave Hansen <dave.hansen@intel.com> - 2015-12-01 22:00 +0100
    Re: [PATCH 3/9] mm: postpone page table allocation until do_set_pte() "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-12-01 22:10 +0100

#1281211 — Re: [PATCH 3/9] mm: postpone page table allocation until do_set_pte()

FromDave Hansen <dave.hansen@intel.com>
Date2015-12-01 22:00 +0100
SubjectRe: [PATCH 3/9] mm: postpone page table allocation until do_set_pte()
Message-ID<qB0bL-6as-9@gated-at.bofh.it>
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?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1281218

From"Kirill A. Shutemov" <kirill@shutemov.name>
Date2015-12-01 22:10 +0100
Message-ID<qB0ls-6t4-11@gated-at.bofh.it>
In reply to#1281211
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web