From: David Mozes <david.mozes@silk.us>
To: "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
Florian Weimer <fweimer@redhat.com>,
Carlos O'Donell <carlos@redhat.com>
Subject: rwlock for async application
Date: Fri, 25 Mar 2022 17:16:06 +0000 [thread overview]
Message-ID: <AM9PR04MB829194D9C98E5708A168568CF11A9@AM9PR04MB8291.eurprd04.prod.outlook.com> (raw)
Hi all,
I want to discuss some needs that I think need to address.
On async coding used mainly on networking and storage applications, how ever I believe on other applications as well, what we are doing is acquiring a lock on the application level, and then call to the OS/kernel for sending/writing
Callback instead of waitengin on blocking for the sending/writing to finish. After completing the OS, call the CB to release the transaction and the lock.
The problem is that the current glibc implumnation doesn't support taking and releasing the writer lock from different threads.
I think it needs to be address .
Actually I did the folwing change:
index d3f36303bf..b1032cfa2a 100644
--- a/nptl/pthread_rwlock_unlock.c
+++ b/nptl/pthread_rwlock_unlock.c
@@ -36,8 +36,7 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
because nobody else can have stored this value. Also, if we are a
reader, we will read from the wrunlock store with value 0 by the most
recent writer because that writer happens-before us. */
- if (atomic_load_relaxed (&rwlock->__data.__cur_writer)
- == THREAD_GETMEM (THREAD_SELF, tid))
+ if (atomic_load_relaxed (&rwlock->__data.__cur_writer))
__pthread_rwlock_wrunlock (rwlock);
else
__pthread_rwlock_rdunlock (rwlock);
On the current unlock function and seems to working so far on heavy load and 3k threads.
I believe it has some limitions and need farther review.and might be calling in different name,but I think it be good to have it.
Your thout?
Thx
David
next reply other threads:[~2022-03-25 17:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 17:16 David Mozes [this message]
2022-03-25 17:38 ` Yann Droneaud
2022-03-29 13:28 ` Adhemerval Zanella
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=AM9PR04MB829194D9C98E5708A168568CF11A9@AM9PR04MB8291.eurprd04.prod.outlook.com \
--to=david.mozes@silk.us \
--cc=adhemerval.zanella@linaro.org \
--cc=carlos@redhat.com \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).