linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] locking/rwsem: Fix DEBUG_RWSEM warning from thaw_super()
@ 2018-05-15 17:38 Waiman Long
  2018-05-15 17:38 ` [PATCH v3 1/2] locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED flag Waiman Long
  2018-05-15 17:38 ` [PATCH v3 2/2] locking/percpu-rwsem: Annotate rwsem ownership transfer by setting RWSEM_OWNER_UNKNOWN Waiman Long
  0 siblings, 2 replies; 21+ messages in thread
From: Waiman Long @ 2018-05-15 17:38 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Thomas Gleixner
  Cc: linux-kernel, linux-fsdevel, Davidlohr Bueso,
	Theodore Y. Ts'o, Oleg Nesterov, Amir Goldstein, Jan Kara,
	Matthew Wilcox, Waiman Long

v3:
 - Modify patch 1 to not expose any new rwsem owner related function.
 - Modify patch 2 to make percpu_rwsem_release() and
   percpu_rwsem_acquire() set the owner field directly, if applicable.

This patchset aims to fix the DEBUG_RWSEM warning in the filesystem
freezing/thawing code. A new macro RWSEM_OWNER_UNKNOWN (-1) is exposed in
the linux/rwsem.h file to indicate that a rwsem is currently owned by an
unknown writer. Other than that, there is no externally visible changes.

The new RWSEM_OWNER_UNKNOWN macro has no dependency on internal rwsem
header. What is important is that bit 1 of the owner field is set which
is the marker used by the internal rwsem code to determine if the owner
is unknown or not.

The original code of clearing the owner field in percpu_rwsem_release()
isn't correct as a NULL owner field should correspond to an unlocked
rwsem which is not the case here. In addition, optimistic spinning
won't be stopped by a NULL owner value.

Testings are welcome.

Waiman Long (2):
  locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED flag
  locking/percpu-rwsem: Annotate rwsem ownership transfer by setting
    RWSEM_OWNER_UNKNOWN

 include/linux/percpu-rwsem.h |  6 +++++-
 include/linux/rwsem.h        |  5 +++++
 kernel/locking/rwsem-xadd.c  | 17 ++++++++---------
 kernel/locking/rwsem.c       |  5 ++---
 kernel/locking/rwsem.h       | 33 ++++++++++++++++++++++++---------
 5 files changed, 44 insertions(+), 22 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-05-15 21:30 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15 17:38 [PATCH v3 0/2] locking/rwsem: Fix DEBUG_RWSEM warning from thaw_super() Waiman Long
2018-05-15 17:38 ` [PATCH v3 1/2] locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED flag Waiman Long
2018-05-15 17:46   ` Peter Zijlstra
2018-05-15 17:48     ` Waiman Long
2018-05-15 17:48   ` Peter Zijlstra
2018-05-15 17:52     ` Waiman Long
2018-05-15 17:55       ` Peter Zijlstra
2018-05-15 17:56         ` Waiman Long
2018-05-15 18:02   ` Peter Zijlstra
2018-05-15 17:38 ` [PATCH v3 2/2] locking/percpu-rwsem: Annotate rwsem ownership transfer by setting RWSEM_OWNER_UNKNOWN Waiman Long
2018-05-15 17:58   ` Peter Zijlstra
2018-05-15 18:02     ` Waiman Long
2018-05-15 18:05       ` Amir Goldstein
2018-05-15 18:45         ` Waiman Long
2018-05-15 18:05       ` Peter Zijlstra
2018-05-15 18:35         ` Waiman Long
2018-05-15 18:02     ` Matthew Wilcox
2018-05-15 18:07       ` Peter Zijlstra
2018-05-15 18:45       ` Waiman Long
2018-05-15 21:21         ` Matthew Wilcox
2018-05-15 21:30           ` Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).