[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77774eb380e343976de3de681204e2c7f3ab1926.camel@HansenPartnership.com>
Date: Mon, 31 Mar 2025 15:51:43 -0400
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: mcgrof@...nel.org, jack@...e.cz, hch@...radead.org, david@...morbit.com,
rafael@...nel.org, djwong@...nel.org, pavel@...nel.org,
peterz@...radead.org, mingo@...hat.com, will@...nel.org,
boqun.feng@...il.com
Subject: Re: [RFC PATCH 1/4] locking/percpu-rwsem: add freezable alternative
to down_read
On Thu, 2025-03-27 at 10:06 -0400, James Bottomley wrote:
[...]
> -static void percpu_rwsem_wait(struct percpu_rw_semaphore *sem, bool
> reader)
> +static void percpu_rwsem_wait(struct percpu_rw_semaphore *sem, bool
> reader,
> + bool freeze)
> {
> DEFINE_WAIT_FUNC(wq_entry, percpu_rwsem_wake_function);
> bool wait;
> @@ -156,7 +157,8 @@ static void percpu_rwsem_wait(struct
> percpu_rw_semaphore *sem, bool reader)
> spin_unlock_irq(&sem->waiters.lock);
>
> while (wait) {
> - set_current_state(TASK_UNINTERRUPTIBLE);
> + set_current_state(TASK_UNINTERRUPTIBLE |
> + freeze ? TASK_FREEZABLE : 0);
This is a bit embarrassing, the bug I've been chasing is here: the ?
operator is lower in precedence than | meaning this expression always
evaluates to TASK_FREEZABLE and nothing else (which is why the process
goes into R state and never wakes up).
Let me fix that and redo all the testing.
Regards,
James
Powered by blists - more mailing lists