linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Uladzislau Rezki <urezki@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux.com>
Subject: Re: [PATCH v2 1/2] percpu: Add __this_cpu_try_cmpxchg()
Date: Tue, 28 May 2024 20:50:20 +0200	[thread overview]
Message-ID: <ZlYnbL8i69sflNEu@pc636> (raw)
In-Reply-To: <20240528144345.5980-1-ubizjak@gmail.com>

On Tue, May 28, 2024 at 04:43:13PM +0200, Uros Bizjak wrote:
> Add __this_cpu_try_cmpxchg() version of the percpu op.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Uladzislau Rezki <urezki@gmail.com>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Lorenzo Stoakes <lstoakes@gmail.com>
> Cc: Dennis Zhou <dennis@kernel.org>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Christoph Lameter <cl@linux.com>
> ---
>  include/linux/percpu-defs.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
> index ec3573119923..8efce7414fad 100644
> --- a/include/linux/percpu-defs.h
> +++ b/include/linux/percpu-defs.h
> @@ -475,6 +475,12 @@ do {									\
>  	raw_cpu_cmpxchg(pcp, oval, nval);				\
>  })
>  
> +#define __this_cpu_try_cmpxchg(pcp, ovalp, nval)			\
> +({									\
> +	__this_cpu_preempt_check("try_cmpxchg");			\
> +	raw_cpu_try_cmpxchg(pcp, ovalp, nval);				\
> +})
> +
>  #define __this_cpu_sub(pcp, val)	__this_cpu_add(pcp, -(typeof(pcp))(val))
>  #define __this_cpu_inc(pcp)		__this_cpu_add(pcp, 1)
>  #define __this_cpu_dec(pcp)		__this_cpu_sub(pcp, 1)
> -- 
> 2.42.0
> 
Acked-by: Uladzislau Rezki (Sony) <urezki@gmail.com>

Thanks!

--
Uladzislau Rezki


      parent reply	other threads:[~2024-05-28 18:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 14:43 Uros Bizjak
2024-05-28 14:43 ` [PATCH v2 2/2] mm/vmalloc: Use __this_cpu_try_cmpxchg() in preload_this_cpu_lock() Uros Bizjak
2024-05-28 18:36   ` Uladzislau Rezki
2024-05-28 18:50 ` Uladzislau Rezki [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=ZlYnbL8i69sflNEu@pc636 \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dennis@kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=tj@kernel.org \
    --cc=ubizjak@gmail.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