From: Valentin Schneider <vschneid@redhat.com>
To: Frederic Weisbecker <frederic@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Cc: geert+renesas@glider.be, tony@atomide.com,
linus.walleij@linaro.org, dave.hansen@linux.intel.com,
Yair Podemsky <ypodemsk@redhat.com>,
sebastian.reichel@collabora.com, linux-mm@kvack.org,
hpa@zytor.com, sparclinux@vger.kernel.org,
agordeev@linux.ibm.com, will@kernel.org, ardb@kernel.org,
linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
arnd@arndb.de, paulmck@kernel.org, aneesh.kumar@linux.ibm.com,
x86@kernel.org, linux@armlinux.org.uk, mingo@redhat.com,
samitolvanen@google.com, borntraeger@linux.ibm.com,
keescook@chromium.org, gor@linux.ibm.com, hca@linux.ibm.com,
npiggin@gmail.com, rmk+kernel@armlinux.org.uk, bp@alien8.de,
nick.hawkins@hpe.com, tglx@linutronix.de, jpoimboe@kernel.org,
linux-arm-kernel@lists.infradead.org, alougovs@redhat.com,
mtosatti@redhat.com, linux-kernel@vger.kernel.org,
juerg.haefliger@canonical.com, svens@linux.ibm.com,
dhildenb@redhat.com, akpm@linux-foundation.org,
linuxppc-dev@lists.ozlabs.org, davem@davemloft.net
Subject: Re: [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode
Date: Wed, 05 Apr 2023 13:45:02 +0100 [thread overview]
Message-ID: <xhsmhpm8ia46p.mognet@vschneid.remote.csb> (raw)
In-Reply-To: <ZC1j8ivE/kK7+Gd5@lothringen>
On 05/04/23 14:05, Frederic Weisbecker wrote:
> static void smp_call_function_many_cond(const struct cpumask *mask,
> smp_call_func_t func, void *info,
> @@ -946,10 +948,13 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
> #endif
> cfd_seq_store(pcpu->seq_queue, this_cpu, cpu, CFD_SEQ_QUEUE);
> if (llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu))) {
> - __cpumask_set_cpu(cpu, cfd->cpumask_ipi);
> - nr_cpus++;
> - last_cpu = cpu;
> -
> + if (!(scf_flags & SCF_NO_USER) ||
> + !IS_ENABLED(CONFIG_GENERIC_ENTRY) ||
> + ct_state_cpu(cpu) != CONTEXT_USER) {
> + __cpumask_set_cpu(cpu, cfd->cpumask_ipi);
> + nr_cpus++;
> + last_cpu = cpu;
> + }
I've been hacking on something like this (CSD deferral for NOHZ-full),
and unfortunately this uses the CPU-local cfd_data storage thing, which
means any further smp_call_function() from the same CPU to the same
destination will spin on csd_lock_wait(), waiting for the target CPU to
come out of userspace and flush the queue - and we've just spent extra
effort into *not* disturbing it, so that'll take a while :(
I don't have much that is in a shareable state yet (though I'm supposed to
talk some more about it at OSPM in <2 weeks, so I'll have to get there),
but ATM I'm playing with
o a bitmask (like in [1]) for coalescable stuff such as do_sync_core() for
x86 instruction patching
o a CSD-like queue for things that need to pass data around, using
statically-allocated storage (so with a limit on how much it can be used) - the
alternative being allocating a struct on sending, since you don't have a
bound on how much crap you can queue on an undisturbed NOHZ-full CPU...
[1]: https://lore.kernel.org/all/20210929152429.067060646@infradead.org/
next prev parent reply other threads:[~2023-04-05 12:46 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 13:42 [PATCH 0/3] send tlb_remove_table_smp_sync IPI only to necessary CPUs Yair Podemsky
2023-04-04 13:42 ` [PATCH 1/3] arch: Introduce ARCH_HAS_CPUMASK_BITS Yair Podemsky
2023-04-04 13:47 ` David Hildenbrand
2023-04-04 13:42 ` [PATCH 2/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to MM CPUs Yair Podemsky
2023-04-04 14:57 ` Peter Zijlstra
2023-04-04 13:42 ` [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode Yair Podemsky
2023-04-04 14:03 ` David Hildenbrand
2023-04-04 15:12 ` Peter Zijlstra
2023-04-04 16:00 ` Peter Zijlstra
2023-04-05 10:43 ` Frederic Weisbecker
2023-04-05 11:10 ` Frederic Weisbecker
2023-04-05 11:41 ` Peter Zijlstra
2023-04-05 12:00 ` David Hildenbrand
2023-04-05 12:05 ` Frederic Weisbecker
2023-04-05 12:31 ` Frederic Weisbecker
2023-04-05 12:45 ` Valentin Schneider [this message]
2023-04-06 13:38 ` Peter Zijlstra
2023-04-06 14:11 ` Valentin Schneider
2023-04-06 14:39 ` Peter Zijlstra
2023-04-05 19:45 ` Marcelo Tosatti
2023-04-05 19:52 ` Peter Zijlstra
2023-04-06 12:38 ` Marcelo Tosatti
2023-04-06 13:29 ` Peter Zijlstra
2023-04-06 14:04 ` Peter Zijlstra
2023-04-06 14:42 ` David Hildenbrand
2023-04-06 15:06 ` Peter Zijlstra
2023-04-06 15:02 ` Peter Zijlstra
2023-04-06 15:51 ` David Hildenbrand
2023-04-06 18:27 ` Peter Zijlstra
2023-04-19 11:30 ` David Hildenbrand
2023-04-19 11:39 ` Marcelo Tosatti
2023-04-05 19:43 ` Marcelo Tosatti
2023-04-05 19:54 ` Peter Zijlstra
2023-04-06 12:49 ` Marcelo Tosatti
2023-04-06 13:32 ` Peter Zijlstra
2023-04-19 11:01 ` Marcelo Tosatti
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=xhsmhpm8ia46p.mognet@vschneid.remote.csb \
--to=vschneid@redhat.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alougovs@redhat.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=borntraeger@linux.ibm.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=dhildenb@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=jpoimboe@kernel.org \
--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=mtosatti@redhat.com \
--cc=nick.hawkins@hpe.com \
--cc=npiggin@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=samitolvanen@google.com \
--cc=sebastian.reichel@collabora.com \
--cc=sparclinux@vger.kernel.org \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=tony@atomide.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=ypodemsk@redhat.com \
/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).