From: Boqun Feng <boqun.feng@gmail.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Brian Foster <bfoster@redhat.com>,
Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH v2] locking: SIX locks (shared/intent/exclusive)
Date: Mon, 22 May 2023 15:05:25 -0700 [thread overview]
Message-ID: <ZGvnJZYQfAmgdsqr@boqun-archlinux> (raw)
In-Reply-To: <20230522171314.1953699-1-kent.overstreet@linux.dev>
On Mon, May 22, 2023 at 01:13:14PM -0400, Kent Overstreet wrote:
[...]
> +/*
> + * bits 0-26 reader count
> + * bits 26-27 write_locking (a thread is trying to get a write lock,
> + * but does not have one yet)
> + * bits 27-28 held for intent
> + * bits 28-29 nospin - optimistic spinning has timed out
Still reading to understand the design (and try to find where are the
first five locks ;-)), but this comment seems to be wrong, because..
> + * bits 29-30 has read waiters
> + * bits 30-31 has intent waiters
> + * bits 31-32 has write waiters
> + */
> +
> +#define SIX_LOCK_HELD_read_OFFSET 0
> +#define SIX_LOCK_HELD_read ~(~0U << 26)
> +#define SIX_LOCK_HELD_intent (1U << 26)
> +#define SIX_LOCK_HELD_write (1U << 27)
> +#define SIX_LOCK_WAITING_read (1U << (28 + SIX_LOCK_read))
> +#define SIX_LOCK_WAITING_intent (1U << (28 + SIX_LOCK_intent))
> +#define SIX_LOCK_WAITING_write (1U << (28 + SIX_LOCK_write))
> +#define SIX_LOCK_NOSPIN (1U << 31)
^ NOSPIN is the 31st bit.
Regards,
Boqun
next prev parent reply other threads:[~2023-05-22 22:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 17:13 Kent Overstreet
2023-05-22 18:58 ` Linus Torvalds
2023-05-22 20:13 ` Kent Overstreet
2023-05-22 20:53 ` Linus Torvalds
2023-05-22 21:52 ` Kent Overstreet
2023-05-22 22:05 ` Boqun Feng [this message]
2023-05-23 4:19 ` Kent Overstreet
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=ZGvnJZYQfAmgdsqr@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=bfoster@redhat.com \
--cc=dchinner@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--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 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®