[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxgMHKeVNS7Mg2nG=Zt_sGGOr1d20gA-s7Q8hhe-zA+kLw@mail.gmail.com>
Date: Tue, 15 May 2018 09:59:14 +0300
From: Amir Goldstein <amir73il@...il.com>
To: Waiman Long <longman@...hat.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Davidlohr Bueso <dave@...olabs.net>,
"Theodore Y. Ts'o" <tytso@....edu>,
Oleg Nesterov <oleg@...hat.com>, Jan Kara <jack@...e.cz>
Subject: Re: [RFC PATCH v2 1/2] locking/rwsem: Add a new RWSEM_WRITER_OWNED_NOSPIN
flag
On Mon, May 14, 2018 at 10:31 PM, Waiman Long <longman@...hat.com> wrote:
> There are use cases where a rwsem can be acquired by one task, but
> released by another task. In thess cases, it may not be appropriate
> for the lock waiters to spin on the task that acquires the lock.
> One example will be the filesystem freeze/thaw code.
>
> To handle such use cases, a new RWSEM_WRITER_OWNED_NOSPIN
> flag can now be set in the owner field of the rwsem by the new
> rwsem_set_writer_owned_nospin() function to indicate that the rwsem is
> writer owned, but optimistic spinning on the rwsem should be disabled.
>
> Later on, the new rwsem_set_writer_owned() function can be called to
> set the new owner, if it is known. This function should not be called
> without a prior rwsem_set_writer_owned_nospin() call.
>
> Signed-off-by: Waiman Long <longman@...hat.com>
Makes sense to me. one nit.
>
> +static inline void __rwsem_set_writer_owned(struct rw_semaphore *sem,
> + struct task_struct *task)
rwsem_set_owner() doesn't pass in task argument and IMO
__rwsem_set_writer_owned() shouldn't either.
Thanks,
Amir.
Powered by blists - more mailing lists