Skip to content

Commit

Permalink
pagewalk: add locking-rule comments
Browse files Browse the repository at this point in the history
Originally, walk_hugetlb_range() didn't require a caller take any lock.
But commit d33b9f4 ("mm: hugetlb: fix hugepage memory leak in
walk_page_range") changed its rule.  Because it added find_vma() call in
walk_hugetlb_range().

Any locking-rule change commit should write a doc too.

[[email protected]: clarify comment]
Signed-off-by: KOSAKI Motohiro <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Hiroyuki Kamezawa <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Matt Mackall <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kosaki authored and torvalds committed Jul 26, 2011
1 parent 6c6d528 commit c27fe4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,8 @@ unsigned long unmap_vmas(struct mmu_gather *tlb,
* @pte_entry: if set, called for each non-empty PTE (4th-level) entry
* @pte_hole: if set, called for each hole at all levels
* @hugetlb_entry: if set, called for each hugetlb entry
* *Caution*: The caller must hold mmap_sem() if @hugetlb_entry
* is used.
*
* (see walk_page_range for more details)
*/
Expand Down
3 changes: 3 additions & 0 deletions mm/pagewalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ static int walk_hugetlb_range(struct vm_area_struct *vma,
*
* If any callback returns a non-zero value, the walk is aborted and
* the return value is propagated back to the caller. Otherwise 0 is returned.
*
* walk->mm->mmap_sem must be held for at least read if walk->hugetlb_entry
* is !NULL.
*/
int walk_page_range(unsigned long addr, unsigned long end,
struct mm_walk *walk)
Expand Down

0 comments on commit c27fe4c

Please sign in to comment.