diff options
author | Nick Piggin <npiggin@suse.de> | 2006-10-20 02:29:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:26:44 -0400 |
commit | 82591e6ea234762eeaa8b2337fe060ed438c18dc (patch) | |
tree | ea521388e91bdf385de546dada0925316eee02e3 /mm | |
parent | b95936cb9267e4c90a0b92361609ef5fd85a0a5f (diff) |
[PATCH] mm: more commenting on lock ordering
Clarify lockorder comments now that sys_msync dropps mmap_sem before
calling do_fsync.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 4 | ||||
-rw-r--r-- | mm/rmap.c | 36 |
2 files changed, 17 insertions, 23 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 57faa8d12099..8558732e85c1 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -75,8 +75,8 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
75 | * ->mmap_sem | 75 | * ->mmap_sem |
76 | * ->lock_page (access_process_vm) | 76 | * ->lock_page (access_process_vm) |
77 | * | 77 | * |
78 | * ->mmap_sem | 78 | * ->i_mutex (generic_file_buffered_write) |
79 | * ->i_mutex (msync) | 79 | * ->mmap_sem (fault_in_pages_readable->do_page_fault) |
80 | * | 80 | * |
81 | * ->i_mutex | 81 | * ->i_mutex |
82 | * ->i_alloc_sem (various) | 82 | * ->i_alloc_sem (various) |
@@ -21,27 +21,21 @@ | |||
21 | * Lock ordering in mm: | 21 | * Lock ordering in mm: |
22 | * | 22 | * |
23 | * inode->i_mutex (while writing or truncating, not reading or faulting) | 23 | * inode->i_mutex (while writing or truncating, not reading or faulting) |
24 | * inode->i_alloc_sem | 24 | * inode->i_alloc_sem (vmtruncate_range) |
25 | * | 25 | * mm->mmap_sem |
26 | * When a page fault occurs in writing from user to file, down_read | 26 | * page->flags PG_locked (lock_page) |
27 | * of mmap_sem nests within i_mutex; in sys_msync, i_mutex nests within | 27 | * mapping->i_mmap_lock |
28 | * down_read of mmap_sem; i_mutex and down_write of mmap_sem are never | 28 | * anon_vma->lock |
29 | * taken together; in truncation, i_mutex is taken outermost. | 29 | * mm->page_table_lock or pte_lock |
30 | * | 30 | * zone->lru_lock (in mark_page_accessed, isolate_lru_page) |
31 | * mm->mmap_sem | 31 | * swap_lock (in swap_duplicate, swap_info_get) |
32 | * page->flags PG_locked (lock_page) | 32 | * mmlist_lock (in mmput, drain_mmlist and others) |
33 | * mapping->i_mmap_lock | 33 | * mapping->private_lock (in __set_page_dirty_buffers) |
34 | * anon_vma->lock | 34 | * inode_lock (in set_page_dirty's __mark_inode_dirty) |
35 | * mm->page_table_lock or pte_lock | 35 | * sb_lock (within inode_lock in fs/fs-writeback.c) |
36 | * zone->lru_lock (in mark_page_accessed, isolate_lru_page) | 36 | * mapping->tree_lock (widely used, in set_page_dirty, |
37 | * swap_lock (in swap_duplicate, swap_info_get) | 37 | * in arch-dependent flush_dcache_mmap_lock, |
38 | * mmlist_lock (in mmput, drain_mmlist and others) | 38 | * within inode_lock in __sync_single_inode) |
39 | * mapping->private_lock (in __set_page_dirty_buffers) | ||
40 | * inode_lock (in set_page_dirty's __mark_inode_dirty) | ||
41 | * sb_lock (within inode_lock in fs/fs-writeback.c) | ||
42 | * mapping->tree_lock (widely used, in set_page_dirty, | ||
43 | * in arch-dependent flush_dcache_mmap_lock, | ||
44 | * within inode_lock in __sync_single_inode) | ||
45 | */ | 39 | */ |
46 | 40 | ||
47 | #include <linux/mm.h> | 41 | #include <linux/mm.h> |