Re: [v3 2/3] mm: Defer TLB flush by keeping both src and dst folios at migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 30, 2023 at 09:51:30PM +0900, Byungchul Park wrote:
> > > diff --git a/mm/memory.c b/mm/memory.c
> > > index 6c264d2f969c..75dc48b6e15f 100644
> > > --- a/mm/memory.c
> > > +++ b/mm/memory.c
> > > @@ -3359,6 +3359,19 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
> > > 	if (vmf->page)
> > > 		folio = page_folio(vmf->page);
> > > 
> > > +	/*
> > > +	 * This folio has its read copy to prevent inconsistency while
> > > +	 * deferring TLB flushes. However, the problem might arise if
> > > +	 * it's going to become writable.
> > > +	 *
> > > +	 * To prevent it, give up the deferring TLB flushes and perform
> > > +	 * TLB flush right away.
> > > +	 */
> > > +	if (folio && migrc_pending_folio(folio)) {
> > > +		migrc_unpend_folio(folio);
> > > +		migrc_try_flush_free_folios(NULL);
> > 
> > So many potential function calls… Probably they should have been combined
> > into one and at least migrc_pending_folio() should have been an inline
> > function in the header.
> 
> I will try to change it as you mention.
> 
> > > +	}
> > > +
> > 
> > What about mprotect? I thought David has changed it so it can set writable
> > PTEs.
> 
> I will check it out.

I found mprotect stuff is already performing TLB flushes needed for it.
So some redundant TLB flushes might happen by migrc but it's not that
harmful I think. Thanks.

	Byungchul




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux