[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180516104829.GA24332@redhat.com>
Date: Wed, 16 May 2018 12:48:30 +0200
From: Oleg Nesterov <oleg@...hat.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@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Davidlohr Bueso <dave@...olabs.net>,
"Theodore Y. Ts'o" <tytso@....edu>,
Amir Goldstein <amir73il@...il.com>, Jan Kara <jack@...e.cz>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v4 1/2] locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED
flag
On 05/15, Waiman Long wrote:
>
> There are use cases where a rwsem can be acquired by one task, but
> released by another task. In thess cases, optimistic spinning may need
> to be disabled. One example will be the filesystem freeze/thaw code
You do not read my emails ;)
Let me repeat once again that in this particular case the writer will
never spin because of owner == NULL. freeze_super() checks SB_UNFROZEN
under sb->s_umount and only then calls sb_wait_write(). IOW, sb_wait_write()
can only be called when this rwsem was already released by the previous
writer.
I am not arguing with this change, percpu_rwsem_release/acquire may have
another user sometime, but the changelog is not accurate.
> +static inline bool is_rwsem_owner_spinnable(struct task_struct *owner)
> {
> - return owner && owner != RWSEM_READER_OWNED;
> + return !((unsigned long)owner & RWSEM_ANONYMOUSLY_OWNED);
> }
Perhaps you should add __attribute__(aligned) to struct rw_semaphore then...
I don't think it is really needed, but see the comment under struct address_space.
Oleg.
Powered by blists - more mailing lists