From: Alexander Aring <aahringo@redhat.com>
To: will@kernel.org
Cc: gfs2@lists.linux.dev, peterz@infradead.org, boqun.feng@gmail.com,
mark.rutland@arm.com
Subject: Re: [RFC 1/2] refcount: introduce generic lockptr funcs
Date: Fri, 3 Nov 2023 12:16:01 -0400 [thread overview]
Message-ID: <CAK-6q+jyGH4Mc2BtzWKOFRjdxwGz35E_JvM6Q4iZD4T4pHxbUw@mail.gmail.com> (raw)
In-Reply-To: <CAK-6q+ivcgxLiYmU7NBLCuiq1HC4RO61yqf_DZDR290sLDbqtw@mail.gmail.com>
Hi,
On Fri, Nov 3, 2023 at 12:14 PM Alexander Aring <aahringo@redhat.com> wrote:
>
> Hi,
>
> On Fri, Nov 3, 2023 at 12:07 PM Alexander Aring <aahringo@redhat.com> wrote:
> >
> > This patch introduce lockptr refcount operations. Currently refcount has
> > a lot of refcount_dec_and_lock() functionality for most common used
> > locktype. Those functions look mostly all the same and is duplicated
> > inside the refcount implementation. Instead of introducing a new whole
> > refcount_dec_and_lock() functionality e.g. for rwlock_t and their _bh
> > variants this patch will introduce lockptr. A lockptr is just a void *
> > and refers to the actual locking instance that can even be an own
> > locking type. Over the passed callbacks for lock and unlock operations
> > the void *lockptr becomes to the real thing by casting it and do the
> > locktype specific lock operation.
>
> just an RFC to check if there is any interest to introduce something
> like this. I think the idea is clear. My current use case is to have
> rwlock_t and its bh lock operations using something like
> refcount_dec_and_write_lock_bh() and later kref_put_write_lock_bh(). I
> try to avoid copying some copy code again. I am open to any better
> design change. Or telling me to just duplicate code again for what I
> need it for. However this has the advantage that somebody can use
> their "own" locktype implementation out of kernel core code.
I will resubmit this RFC series because I forgot to cc the linux
kernel mailing list that indeed makes sense here.
- Alex
next prev parent reply other threads:[~2023-11-03 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 16:06 [RFC 1/2] refcount: introduce generic lockptr funcs Alexander Aring
2023-11-03 16:06 ` [RFC 2/2] kref: introduce kref_put_lockptr() and use lockptr Alexander Aring
2023-11-03 16:14 ` [RFC 1/2] refcount: introduce generic lockptr funcs Alexander Aring
2023-11-03 16:16 ` Alexander Aring [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-11-03 16:16 Alexander Aring
2023-11-03 18:54 ` Peter Zijlstra
2023-11-03 19:20 ` Alexander Aring
2023-11-06 11:11 ` Peter Zijlstra
2023-11-06 15:12 ` Alexander Aring
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=CAK-6q+jyGH4Mc2BtzWKOFRjdxwGz35E_JvM6Q4iZD4T4pHxbUw@mail.gmail.com \
--to=aahringo@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=gfs2@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.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 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).