[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231108041208.GA40954@system.software.com>
Date: Wed, 8 Nov 2023 13:12:08 +0900
From: Byungchul Park <byungchul@...com>
To: Nadav Amit <namit@...are.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>,
"kernel_team@...ynix.com" <kernel_team@...ynix.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"ying.huang@...el.com" <ying.huang@...el.com>,
"xhao@...ux.alibaba.com" <xhao@...ux.alibaba.com>,
"mgorman@...hsingularity.net" <mgorman@...hsingularity.net>,
"hughd@...gle.com" <hughd@...gle.com>,
"willy@...radead.org" <willy@...radead.org>,
"david@...hat.com" <david@...hat.com>,
"peterz@...radead.org" <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
Subject: Re: [v3 2/3] mm: Defer TLB flush by keeping both src and dst folios
at migration
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
Powered by blists - more mailing lists