mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Dave Hansen <dave.hansen@intel.com>, Rik van Riel <riel@surriel.com>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Mel Gorman <mgorman@suse.de>,
	x86@kernel.org
Subject: Re: [PATCH] smp: Evaluate local cond_func() before IPI side-effects
Date: Thu, 5 Dec 2024 09:59:26 -0500	[thread overview]
Message-ID: <0a5255db-5455-4317-979c-191cae3ff42b@efficios.com> (raw)
In-Reply-To: <cc8e8ed4-0181-492a-aff4-71ce5841c891@intel.com>

On 2024-12-03 20:38, Dave Hansen wrote:
> On 12/3/24 10:39, Mathieu Desnoyers wrote:
>> If cond_func() depends on loading shared state updated by other CPU's
>> IPI handlers func(), then triggering execution of remote CPUs IPI before
>> evaluating cond_func() may have unexpected consequences.
> 
> I always thought this was on purpose so cond_func() can be executed in
> parallel with the remote work.
> 
> Could we double-check that this doesn't meaningfully slow down IPIs that
> have longer work to do?

I notice that this question was not answered. I did do extensive
benchmark of this effect, but I would not expect a significant
impact there, because the cond_func() I've seen (there are very
few users) are all really short, and should be much shorter than
doing the IPI, so I expect a negligible performance overhead.

But we'll see if any bot observe something unexpected.

Caller code:

fs/buffer.c
1530:	on_each_cpu_cond(has_bh_in_lru, invalidate_bh_lru, NULL, 1);

#define BH_LRU_SIZE     16

bool has_bh_in_lru(int cpu, void *dummy)
{
         struct bh_lru *b = per_cpu_ptr(&bh_lrus, cpu);
         int i;
         
         for (i = 0; i < BH_LRU_SIZE; i++) {
                 if (b->bhs[i])
                         return true;
         }

         return false;
}

arch/x86/mm/tlb.c
932:		on_each_cpu_cond_mask(tlb_is_not_lazy, flush_tlb_func,

^ this is the small function introduced by Rik's patches.

Thanks,

Mathieu


-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


      reply	other threads:[~2024-12-05 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 18:39 Mathieu Desnoyers
2024-12-04  1:38 ` Dave Hansen
2024-12-05 14:59   ` Mathieu Desnoyers [this message]

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=0a5255db-5455-4317-979c-191cae3ff42b@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®