linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 00/12] lockdep: Implement crossrelease feature
@ 2016-06-20  4:55 Byungchul Park
  2016-06-20  4:55 ` [RFC 01/12] lockdep: Refactor lookup_chain_cache() Byungchul Park
                   ` (13 more replies)
  0 siblings, 14 replies; 38+ messages in thread
From: Byungchul Park @ 2016-06-20  4:55 UTC (permalink / raw)
  To: peterz, mingo; +Cc: linux-kernel, npiggin, walken, ak, tglx

Crossrelease feature calls a lock which is releasable by a
different context from the context having acquired the lock,
crosslock. For crosslock, all locks having been held in the
context unlocking the crosslock, until eventually the crosslock
will be unlocked, have dependency with the crosslock. That's a
key idea to implement crossrelease feature.

Crossrelease feature introduces 2 new data structures.

1. pend_lock (== plock)

	This is for keeping locks waiting to commit those so
	that an actual dependency chain is built, when commiting
	a crosslock.

	Every task_struct has an array of this pending lock to
	keep those locks. These pending locks will be added
	whenever lock_acquire() is called for normal(non-crosslock)
	lock and will be flushed(committed) at proper time.

2. cross_lock (== xlock)

	This keeps some additional data only for crosslock. There
	is one cross_lock per one lockdep_map for crosslock.
	lockdep_init_map_crosslock() should be used instead of
	lockdep_init_map() to use the lock as a crosslock.

Acquiring and releasing sequence for crossrelease feature:

1. Acquire

	All validation check is performed for all locks.

	1) For non-crosslock (normal lock)

		The hlock will be added not only to held_locks
		of the current's task_struct, but also to
		pend_lock array of the task_struct, so that
		a dependency chain can be built with the lock
		when doing commit.

	2) For crosslock

		The hlock will be added only to the cross_lock
		of the lock's lockdep_map instead of held_locks,
		so that a dependency chain can be built with
		the lock when doing commit. And this lock is
		added to the xlocks_head list.

2. Commit (only for crosslock)

	This establishes a dependency chain between the lock
	unlocking it now and all locks having held in the context
	unlocking it since the lock was held, even though it tries
	to avoid building a chain unnecessarily as far as possible.

3. Release

	1) For non-crosslock (normal lock)

		No change.

	2) For crosslock

		Just Remove the lock from xlocks_head list. Release
		operation should be used with commit operation
		together for crosslock, in order to build a
		dependency chain properly.

Byungchul Park (12):
  lockdep: Refactor lookup_chain_cache()
  lockdep: Add a function building a chain between two hlocks
  lockdep: Make check_prev_add can use a stack_trace of other context
  lockdep: Make save_trace can copy from other stack_trace
  lockdep: Implement crossrelease feature
  lockdep: Apply crossrelease to completion
  pagemap.h: Remove trailing white space
  lockdep: Apply crossrelease to PG_locked lock
  cifs/file.c: Remove trailing white space
  mm/swap_state.c: Remove trailing white space
  lockdep: Call lock_acquire(release) when accessing PG_locked manually
  x86/dumpstack: Optimize save_stack_trace

 arch/x86/include/asm/stacktrace.h |   1 +
 arch/x86/kernel/dumpstack.c       |   2 +
 arch/x86/kernel/dumpstack_32.c    |   2 +
 arch/x86/kernel/stacktrace.c      |   7 +
 fs/cifs/file.c                    |   6 +-
 include/linux/completion.h        | 121 +++++-
 include/linux/irqflags.h          |  16 +-
 include/linux/lockdep.h           | 139 +++++++
 include/linux/mm_types.h          |   9 +
 include/linux/pagemap.h           | 104 ++++-
 include/linux/sched.h             |   5 +
 kernel/fork.c                     |   4 +
 kernel/locking/lockdep.c          | 846 +++++++++++++++++++++++++++++++++++---
 kernel/sched/completion.c         |  55 +--
 lib/Kconfig.debug                 |  30 ++
 mm/filemap.c                      |  10 +-
 mm/ksm.c                          |   1 +
 mm/migrate.c                      |   1 +
 mm/page_alloc.c                   |   3 +
 mm/shmem.c                        |   2 +
 mm/swap_state.c                   |  12 +-
 mm/vmscan.c                       |   1 +
 22 files changed, 1255 insertions(+), 122 deletions(-)

-- 
1.9.1

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

end of thread, other threads:[~2016-07-06  8:14 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-20  4:55 [RFC 00/12] lockdep: Implement crossrelease feature Byungchul Park
2016-06-20  4:55 ` [RFC 01/12] lockdep: Refactor lookup_chain_cache() Byungchul Park
2016-06-20  4:55 ` [RFC 02/12] lockdep: Add a function building a chain between two hlocks Byungchul Park
2016-06-20  4:55 ` [RFC 03/12] lockdep: Make check_prev_add can use a stack_trace of other context Byungchul Park
2016-06-20  4:55 ` [RFC 04/12] lockdep: Make save_trace can copy from other stack_trace Byungchul Park
2016-06-20  4:55 ` [RFC 05/12] lockdep: Implement crossrelease feature Byungchul Park
2016-06-30 13:03   ` Peter Zijlstra
2016-06-30 23:28     ` Byungchul Park
2016-06-20  4:55 ` [RFC 06/12] lockdep: Apply crossrelease to completion Byungchul Park
2016-06-20  4:55 ` [RFC 07/12] pagemap.h: Remove trailing white space Byungchul Park
2016-06-20  4:55 ` [RFC 08/12] lockdep: Apply crossrelease to PG_locked lock Byungchul Park
2016-06-30 13:04   ` Peter Zijlstra
2016-06-30 23:21     ` Byungchul Park
2016-07-01  8:10       ` Peter Zijlstra
2016-07-01 11:18       ` Kirill A. Shutemov
2016-07-04  4:30         ` Byungchul Park
2016-06-20  4:55 ` [RFC 09/12] cifs/file.c: Remove trailing white space Byungchul Park
2016-06-20  4:55 ` [RFC 10/12] mm/swap_state.c: " Byungchul Park
2016-06-20  4:55 ` [RFC 11/12] lockdep: Call lock_acquire(release) when accessing PG_locked manually Byungchul Park
2016-06-20  4:55 ` [RFC 12/12] x86/dumpstack: Optimize save_stack_trace Byungchul Park
2016-06-20  7:29   ` xinhui
2016-06-20  7:50     ` byungchul.park
2016-06-29 12:43       ` Byungchul Park
2016-06-30 10:38         ` xinhui
2016-06-30 23:06           ` Byungchul Park
2016-06-23 23:37 ` [RFC 00/12] lockdep: Implement crossrelease feature Byungchul Park
2016-06-24  7:08   ` Peter Zijlstra
2016-06-24 11:13     ` Byungchul Park
2016-06-24 11:26   ` Nikolay Borisov
2016-06-27  1:34     ` Byungchul Park
2016-07-01  4:15 ` [PATCH] lockdep: Add a document describing " Byungchul Park
2016-07-01 10:45   ` Peter Zijlstra
2016-07-04  6:42     ` Byungchul Park
2016-07-06  0:49       ` Boqun Feng
2016-07-06  2:17         ` Byungchul Park
2016-07-06  5:33           ` Byungchul Park
2016-07-06  7:56             ` Peter Zijlstra
2016-07-06  8:12               ` Byungchul Park

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).