From: David Miller <davem@davemloft.net>
To: arnd@arndb.de
Cc: tgraf@suug.ch, herbert@gondor.apana.org.au, neilb@suse.com,
tom@quantonium.net, keescook@chromium.org, paulb@mellanox.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] test_rhashtable: remove semaphore usage
Date: Mon, 10 Dec 2018 17:29:12 -0800 (PST) [thread overview]
Message-ID: <20181210.172912.1960183648027850219.davem@davemloft.net> (raw)
In-Reply-To: <20181210211957.210189-1-arnd@arndb.de>
From: Arnd Bergmann <arnd@arndb.de>
Date: Mon, 10 Dec 2018 22:17:20 +0100
> This is one of only two files that initialize a semaphore to a negative
> value. We don't really need the two semaphores here at all, but can do
> the same thing in more conventional and more effient way, by using a
> single waitqueue and an atomic thread counter.
>
> This gets us a little bit closer to eliminating classic semaphores from
> the kernel. It also fixes a corner case where we fail to continue after
> one of the threads fails to start up.
>
> An alternative would be to use a split kthread_create()+wake_up_process()
> and completely eliminate the separate synchronization.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> This is part of a longer, untested, series to remove semaphores
> from the kernel, please review as such before applying.
This looks fine to me, although it seems kinda weird how the
synchronization works in that the N - 1 child threads will
be awoken two times, once when child N decrements the count
to zero and once when the parent decrements the count to -1
which lets us past the wait_event_interruptibel().
Nevertheless it should work just fine and I have no problems
with it.
Want me to apply this to net-next?
Thanks.
next prev parent reply other threads:[~2018-12-11 1:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 21:17 Arnd Bergmann
2018-12-11 1:29 ` David Miller [this message]
2018-12-11 5:45 ` Herbert Xu
2018-12-11 7:38 ` Phil Sutter
2018-12-14 21:25 ` David Miller
2018-12-16 19:50 ` Arnd Bergmann
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=20181210.172912.1960183648027850219.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=arnd@arndb.de \
--cc=herbert@gondor.apana.org.au \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.com \
--cc=netdev@vger.kernel.org \
--cc=paulb@mellanox.com \
--cc=tgraf@suug.ch \
--cc=tom@quantonium.net \
/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
all inboxes | Powered by JetHome®