linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: ypodemsk@redhat.com
To: Dave Hansen <dave.hansen@intel.com>,
	mtosatti@redhat.com,  ppandit@redhat.com, david@redhat.com,
	linux@armlinux.org.uk, mpe@ellerman.id.au,  npiggin@gmail.com,
	christophe.leroy@csgroup.eu, hca@linux.ibm.com,
	 gor@linux.ibm.com, agordeev@linux.ibm.com,
	borntraeger@linux.ibm.com,  svens@linux.ibm.com,
	davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com,
	 bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
	keescook@chromium.org,  paulmck@kernel.org, frederic@kernel.org,
	will@kernel.org, peterz@infradead.org,  ardb@kernel.org,
	samitolvanen@google.com, juerg.haefliger@canonical.com,
	 arnd@arndb.de, rmk+kernel@armlinux.org.uk,
	geert+renesas@glider.be,  linus.walleij@linaro.org,
	akpm@linux-foundation.org,  sebastian.reichel@collabora.com,
	rppt@kernel.org, aneesh.kumar@linux.ibm.com,  x86@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
	 sparclinux@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to MM CPUs
Date: Thu, 22 Jun 2023 16:14:58 +0300	[thread overview]
Message-ID: <79f29f99fa07c46dbaee7b802cdd7b477b2d8dd1.camel@redhat.com> (raw)
In-Reply-To: <680fadba-9104-3914-5175-e207fd3d9246@intel.com>

On Wed, 2023-06-21 at 10:42 -0700, Dave Hansen wrote:
> On 6/20/23 07:46, Yair Podemsky wrote:
> > -void tlb_remove_table_sync_one(void)
> > +#ifdef CONFIG_ARCH_HAS_CPUMASK_BITS
> > +#define REMOVE_TABLE_IPI_MASK mm_cpumask(mm)
> > +#else
> > +#define REMOVE_TABLE_IPI_MASK cpu_online_mask
> > +#endif /* CONFIG_ARCH_HAS_CPUMASK_BITS */
> > +
> > +void tlb_remove_table_sync_one(struct mm_struct *mm)
> >  {
> >  	/*
> >  	 * This isn't an RCU grace period and hence the page-tables
> > cannot be
> > @@ -200,7 +206,8 @@ void tlb_remove_table_sync_one(void)
> >  	 * It is however sufficient for software page-table walkers
> > that rely on
> >  	 * IRQ disabling.
> >  	 */
> > -	smp_call_function(tlb_remove_table_smp_sync, NULL, 1);
> > +	on_each_cpu_mask(REMOVE_TABLE_IPI_MASK,
> > tlb_remove_table_smp_sync,
> > +			NULL, true);
> >  }
> 
> That "REMOVE_TABLE_IPI_MASK" thing is pretty confusing.  It *looks*
> like
> a constant.  It does *NOT* look at all like it consumes 'mm'.  Worst
> case, just create a local variable:
> 
> 	if (IS_ENABLED(CONFIG_ARCH_HAS_CPUMASK_BITS))
> 		ipi_mask = mm_cpumask(mm);
> 	else
> 		ipi_mask = cpu_online_mask;
> 
> 	on_each_cpu_mask(ipi_mask, ...);
> 
> That's a billion times more clear and it'll compile down to the same
> thing.
> 
> I do think the CONFIG_ARCH_HAS_CPUMASK_BITS naming is also pretty
> confusing, but I don't have any better suggestions.  Maybe something
> with "MM_CPUMASK" in it?
> 

Hi Dave,
Thanks for your suggestions!
I will send a new version with the local variable as you suggested
soon.
As for the config name, what about CONFIG_ARCH_HAS_MM_CPUMASK?
Thanks,
Yair



  reply	other threads:[~2023-06-22 13:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 14:46 [PATCH v2 0/2] send tlb_remove_table_smp_sync IPI only to necessary CPUs Yair Podemsky
2023-06-20 14:46 ` [PATCH v2 1/2] arch: Introduce ARCH_HAS_CPUMASK_BITS Yair Podemsky
2023-06-20 14:46 ` [PATCH v2 2/2] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to MM CPUs Yair Podemsky
2023-06-21 17:42   ` Dave Hansen
2023-06-22 13:14     ` ypodemsk [this message]
2023-06-22 13:37       ` Dave Hansen
2023-06-26 14:36         ` ypodemsk
2023-06-26 15:23           ` Dave Hansen
2023-06-21 18:02   ` Nadav Amit
2023-06-22 13:57     ` ypodemsk
2023-06-23  3:38     ` Yang Shi
2023-07-03 13:57   ` Peter Zijlstra
2023-06-21  7:43 ` [PATCH v2 0/2] send tlb_remove_table_smp_sync IPI only to necessary CPUs Peter Zijlstra
2023-06-22 12:47   ` Marcelo Tosatti
2023-07-03 14:09     ` Peter Zijlstra
2023-06-22 13:11   ` ypodemsk

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=79f29f99fa07c46dbaee7b802cdd7b477b2d8dd1.camel@redhat.com \
    --to=ypodemsk@redhat.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=david@redhat.com \
    --cc=frederic@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=juerg.haefliger@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=mtosatti@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ppandit@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=rppt@kernel.org \
    --cc=samitolvanen@google.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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).