[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b4f3dac-779a-4eef-945b-3ca1455c0dfe@redhat.com>
Date: Tue, 19 Mar 2024 11:53:50 -0400
From: Waiman Long <longman@...hat.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Matthew Wilcox <willy@...radead.org>
Cc: linux-kernel@...r.kernel.org, Boqun Feng <boqun.feng@...il.com>,
Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, Will Deacon <will@...nel.org>,
Clark Williams <williams@...hat.com>
Subject: Re: [PATCH] Locking: Let PREEMPT_RT compile again with new rwsem
asserts.
On 3/19/24 10:15, Sebastian Andrzej Siewior wrote:
> On 2024-03-19 13:38:06 [+0000], Matthew Wilcox wrote:
>> On Tue, Mar 19, 2024 at 08:05:50AM +0100, Sebastian Andrzej Siewior wrote:
>>> -static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)
>>> +static __always_inline bool rwsem_held_write(const struct rw_semaphore *sem)
>> The locking maintainers were very clear that this predicate Should Not
>> Exist. It encourages people to write bad code. Assertions only!
> What do you refer to? The inline vs __always_inline or
> rwsem_held_write() should not exists and it should invoke directly
> rw_base_is_write_locked()?
Just merge rwsem_held_write() into rwsem_assert_held_write_nolockdep()
and we should be all set.
Cheers,
Longman
>>> {
>>> - rw_base_assert_held_write(sem);
>>> + return rw_base_is_write_locked(&sem->rwbase);
>>> +}
>>> +
>>> +static __always_inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem)
>>> +{
>>> + WARN_ON(!rwsem_held_write(sem));
>>> }
>>>
>>> static __always_inline int rwsem_is_contended(struct rw_semaphore *sem)
> Sebastian
>
Powered by blists - more mailing lists