linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: bpf <bpf@vger.kernel.org>, linux-mm <linux-mm@kvack.org>,
	 Linus Torvalds <torvalds@linux-foundation.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	 Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	 Peter Zijlstra <peterz@infradead.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	 Sebastian Sewior <bigeasy@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	Michal Hocko <mhocko@suse.com>,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] locking/local_lock, mm: Replace localtry_ helpers with local_trylock_t type
Date: Wed, 2 Apr 2025 20:48:39 -0700	[thread overview]
Message-ID: <CAADnVQ+Uy_sctUkEFN4P6GEO_=5Q6n2XNonWaJYfz7uW90QWTQ@mail.gmail.com> (raw)
In-Reply-To: <20250402201252.8926c547a327ce91c61fd620@linux-foundation.org>

On Wed, Apr 2, 2025 at 8:12 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed,  2 Apr 2025 19:55:14 -0700 Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>
> > Partially revert commit 0aaddfb06882 ("locking/local_lock: Introduce localtry_lock_t").
> > Remove localtry_*() helpers, since localtry_lock() name might
> > be misinterpreted as "try lock".
> >
>
> So many macros grumble.
>
> +#define local_trylock_init(lock)       __local_trylock_init(lock)
> +#define local_trylock(lock)            __local_trylock(lock)
> +#define local_trylock_irqsave(lock, flags)                     \
> +#define __local_trylock_init(lock) __local_lock_init(lock.llock)
> +#define __local_lock_acquire(lock)                                     \
> +#define __local_trylock(lock)                                  \
> +#define __local_trylock_irqsave(lock, flags)                   \
> +#define __local_lock_release(lock)                                     \
> +#define __local_unlock(lock)                                   \
> +#define __local_unlock_irq(lock)                               \
> +#define __local_unlock_irqrestore(lock, flags)                 \
> +#define __local_lock_nested_bh(lock)                           \
> +#define __local_unlock_nested_bh(lock)                         \
> +#define __local_trylock_init(l)                        __local_lock_init(l)
> +#define __local_trylock(lock)                                  \
> +#define __local_trylock_irqsave(lock, flags)                   \
>
> I expect many of these could have been implemented as static inlines.
>
> Oh well, that's a separate project for someone sometime.

They need to be macroses otherwise _Generic() trick won't work.

Thanks for applying v3.

Do you want to take "mm/page_alloc: Avoid second trylock of zone->lock"
fix as well ?

https://lore.kernel.org/all/20250331002809.94758-1-alexei.starovoitov@gmail.com/

or should I ?


  reply	other threads:[~2025-04-03  3:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03  2:55 Alexei Starovoitov
2025-04-03  3:12 ` Andrew Morton
2025-04-03  3:48   ` Alexei Starovoitov [this message]
2025-04-03  4:06     ` Andrew Morton

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='CAADnVQ+Uy_sctUkEFN4P6GEO_=5Q6n2XNonWaJYfz7uW90QWTQ@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=martin.lau@kernel.org \
    --cc=mhocko@suse.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shakeel.butt@linux.dev \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    /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