linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Andrii Nakryiko <andrii@kernel.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Sebastian Sewior <bigeasy@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Hou Tao <houtao1@huawei.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Michal Hocko <mhocko@suse.com>,
	Matthew Wilcox <willy@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jann Horn <jannh@google.com>, Tejun Heo <tj@kernel.org>,
	linux-mm <linux-mm@kvack.org>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next v8 3/6] locking/local_lock: Introduce localtry_lock_t
Date: Fri, 14 Feb 2025 13:15:53 +0100	[thread overview]
Message-ID: <cc82c78c-b878-4d9d-b671-7609fd9e7b81@suse.cz> (raw)
In-Reply-To: <CAADnVQLHRb8fu9J6Yd63ZDBtJFzZN1oWfwSDA_QXFqzXyr9F5g@mail.gmail.com>

On 2/13/25 16:23, Alexei Starovoitov wrote:
> On Thu, Feb 13, 2025 at 7:04 AM Vlastimil Babka <vbabka@suse.cz> wrote:
>>
>>
>> > +
>> > +#define __localtry_trylock_irqsave(lock, flags)                      \
>> > +     ({                                                      \
>> > +             int __locked;                                   \
>> > +                                                             \
>> > +             typecheck(unsigned long, flags);                \
>> > +             flags = 0;                                      \
>> > +             if (in_nmi() | in_hardirq()) {                  \
>> > +                     __locked = 0;                           \
>>
>> Because of this, IIUC?
> 
> Right.
> It's part of commit log:
> + In PREEMPT_RT local_lock_irqsave() maps to preemptible spin_lock().
> + Map localtry_lock_irqsave() to preemptible spin_trylock().
> + When in hard IRQ or NMI return false right away, since
> + spin_trylock() is not safe due to PI issues.
> 
> Steven explained it in detail in some earlier thread.
> 
> realtime is hard. bpf and realtime together are even harder.
> Things got much better over the years, but plenty of work ahead.
> I can go in detail, but offtopic for this thread.

Thanks, it's fine. Just that the comment of the function could be more clear
then, so people don't have to check implementation/commit log/lore
discussions :)


  parent reply	other threads:[~2025-02-14 12:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13  3:35 [PATCH bpf-next v8 0/6] bpf, mm: Introduce try_alloc_pages() Alexei Starovoitov
2025-02-13  3:35 ` [PATCH bpf-next v8 1/6] mm, bpf: Introduce try_alloc_pages() for opportunistic page allocation Alexei Starovoitov
2025-02-13  3:35 ` [PATCH bpf-next v8 2/6] mm, bpf: Introduce free_pages_nolock() Alexei Starovoitov
2025-02-13  3:35 ` [PATCH bpf-next v8 3/6] locking/local_lock: Introduce localtry_lock_t Alexei Starovoitov
2025-02-13 15:03   ` Vlastimil Babka
2025-02-13 15:23     ` Alexei Starovoitov
2025-02-13 15:28       ` Steven Rostedt
2025-02-14 12:15       ` Vlastimil Babka [this message]
2025-02-14 12:11   ` Vlastimil Babka
2025-02-14 18:32     ` Alexei Starovoitov
2025-02-14 18:48       ` Vlastimil Babka
2025-02-17 15:17         ` Sebastian Sewior
2025-02-18 15:17   ` Vlastimil Babka
2025-02-13  3:35 ` [PATCH bpf-next v8 4/6] memcg: Use trylock to access memcg stock_lock Alexei Starovoitov
2025-02-13  3:35 ` [PATCH bpf-next v8 5/6] mm, bpf: Use memcg in try_alloc_pages() Alexei Starovoitov
2025-02-13  3:35 ` [PATCH bpf-next v8 6/6] bpf: Use try_alloc_pages() to allocate pages for bpf needs Alexei Starovoitov
2025-02-18 15:36   ` Vlastimil Babka
2025-02-19  2:38     ` Alexei Starovoitov

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=cc82c78c-b878-4d9d-b671-7609fd9e7b81@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=bpf@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=houtao1@huawei.com \
    --cc=jannh@google.com \
    --cc=kernel-team@fb.com \
    --cc=linux-mm@kvack.org \
    --cc=memxor@gmail.com \
    --cc=mhocko@suse.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shakeel.butt@linux.dev \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=willy@infradead.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