linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@gentwo.de>
To: Wen Yao <haiwenyao@uniontech.com>
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu,  dennis@kernel.org, tj@kernel.org,
	linux-riscv@lists.infradead.org,  linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH 1/2] riscv: percpu:Add riscv percpu operations
Date: Sun, 30 Oct 2022 14:19:22 +0100 (CET)	[thread overview]
Message-ID: <f1b82a9-a88b-50f5-8b49-69e52d7bdaa9@gentwo.de> (raw)
In-Reply-To: <20221026104015.565468-2-haiwenyao@uniontech.com>

On Wed, 26 Oct 2022, Wen Yao wrote:

> This patch use riscv AMO(Atomic Memory Operation) instructions to
> optimise some this_cpu_and this_cpu_or this_cpu_add operations.
> It reuse cmpxchg_local() to impletment this_cpu_cmpxchg macros.
> It reuse xchg_relaxed() to impletment this_cpu_xchg macros.

Are you sure that these changes gives you any benefit vs disabling preempt
or irq offs? I dont know too much about atomics on riscv but it looks like
you are using full atomics. The performance penalty for the use of those
is usually drastic. Often irq/preempt off is better.

Could you run some of the synthetic tests to establish the benefit? F.e.
run the synthetic tests for the slub allcator with and without these
patches.


> +			__asm__ __volatile__(                                  \
> +				"amo" #asm_op ".w"                             \

amo = atomic operation?


  parent reply	other threads:[~2022-10-30 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 10:40 [PATCH 0/2] riscv: Rewrite percpu operations and support cmpxchg-local feature Wen Yao
2022-10-26 10:40 ` [PATCH 1/2] riscv: percpu:Add riscv percpu operations Wen Yao
2022-10-26 18:54   ` Conor Dooley
2022-10-27  0:14   ` kernel test robot
2022-10-27  1:05   ` kernel test robot
2022-10-30 13:19   ` Christoph Lameter [this message]
2022-10-26 10:40 ` [PATCH 2/2] riscv:kconfig:select HAVE_CMPXCHG_LOCAL Wen Yao

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=f1b82a9-a88b-50f5-8b49-69e52d7bdaa9@gentwo.de \
    --to=cl@gentwo.de \
    --cc=aou@eecs.berkeley.edu \
    --cc=dennis@kernel.org \
    --cc=haiwenyao@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=tj@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