All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Waiman Long <longman@redhat.com>,
	Shakeel Butt <shakeelb@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Boqun Feng <boqun.feng@gmail.com>,
	Will Deacon <will@kernel.org>, Roman Penyaev <rpenyaev@suse.de>
Subject: Re: [PATCH] locking/rwlocks: do not starve writers
Date: Fri, 17 Jun 2022 21:39:03 +0200	[thread overview]
Message-ID: <CANn89iJXeUJRV2+8reUdaeARxYPPbCoG+9atmRFfy4kv0XX00A@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wi9ut1VkB=Ja_gYtH67DZ7cc5QBG-uJCPkOpU=MZDJSUw@mail.gmail.com>

On Fri, Jun 17, 2022 at 9:35 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Fri, Jun 17, 2022 at 2:25 PM Eric Dumazet <edumazet@google.com> wrote:
> >
> > Interesting...
> >
> >  I think getrusage(RUSAGE_SELF) is blocking interrupts in the
> > possible long loop:
>
> Yeah, that looks bad.
>
> It needs that interrupt disable due to sighand->siglock, but normally
> we would expect to *not* have a big loop inside the siglock.
>
> Nasty.
>
> I wonder if this is possibly a situation where we should actually make
> siglock be a rwlock.
>
> But considering that this RUSAGE_SELF is hopefully a special case,
> maybe we could write it differently.
>
> Instead of taking the sighand lock, we might be able to iterate just
> over the regular thread list (using the tasklist lock), and then do
> the "does sighand match" as a one-off check in
> accumulate_thread_rusage().
>
> It's not like we even really need that strict locking there, I suspect.
>
> Anyway, I should have noted in my previous email that my "rwlock is
> often not the win you'd think it is" that that is only true for this
> *spinning* rwlock.
>
> For the actual sleeping reader-writer lock (down_read/down_write and
> friends), the whole "you can have multiple readers" is often a *huge*
> deal and very central to using a rwlock. It's literally just the
> spinning one that is often better as a spinlock unless you have those
> magical reasons to use it.
>

I am converting RAW sockets to RCU.

We will likely need to use RCU in place of rwlock in most networking code.

  reply	other threads:[~2022-06-17 19:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17  9:10 [PATCH] locking/rwlocks: do not starve writers Eric Dumazet
2022-06-17 12:07 ` Peter Zijlstra
2022-06-17 14:43   ` Waiman Long
2022-06-17 14:57     ` Shakeel Butt
2022-06-17 15:00       ` Waiman Long
2022-06-17 15:24         ` Eric Dumazet
2022-06-17 15:56           ` Peter Zijlstra
2022-06-17 17:41           ` Waiman Long
2022-06-17 17:45             ` Eric Dumazet
2022-06-17 18:57               ` Waiman Long
2022-06-18  8:43                 ` Hillf Danton
2022-06-17 19:04               ` Peter Zijlstra
2022-06-17 19:10                 ` Eric Dumazet
2022-06-17 19:19                   ` Linus Torvalds
2022-06-17 19:25                     ` Eric Dumazet
2022-06-17 19:34                       ` Linus Torvalds
2022-06-17 19:39                         ` Eric Dumazet [this message]
2022-06-17 19:48                           ` Linus Torvalds
2022-06-20  7:25                             ` Peter Zijlstra
2022-06-21 16:55                             ` Eric W. Biederman
2022-06-17 21:58                           ` David Laight
2022-06-17 19:34                     ` Shakeel Butt
2022-06-17 19:08               ` Linus Torvalds

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=CANn89iJXeUJRV2+8reUdaeARxYPPbCoG+9atmRFfy4kv0XX00A@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=boqun.feng@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rpenyaev@suse.de \
    --cc=shakeelb@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.