提交 ea4525b6 编写于 作者: N Namhyung Kim 提交者: Linus Torvalds

rmap: annotate lock context change on page_[un]lock_anon_vma()

The page_lock_anon_vma() conditionally grabs RCU and anon_vma lock but
page_unlock_anon_vma() releases them unconditionally.  This leads sparse
to complain about context imbalance.  Annotate them.
Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 1b36ba81
......@@ -230,7 +230,20 @@ int try_to_munlock(struct page *);
/*
* Called by memory-failure.c to kill processes.
*/
struct anon_vma *page_lock_anon_vma(struct page *page);
struct anon_vma *__page_lock_anon_vma(struct page *page);
static inline struct anon_vma *page_lock_anon_vma(struct page *page)
{
struct anon_vma *anon_vma;
__cond_lock(RCU, anon_vma = __page_lock_anon_vma(page));
/* (void) is needed to make gcc happy */
(void) __cond_lock(&anon_vma->root->lock, anon_vma);
return anon_vma;
}
void page_unlock_anon_vma(struct anon_vma *anon_vma);
int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
......
......@@ -314,7 +314,7 @@ void __init anon_vma_init(void)
* Getting a lock on a stable anon_vma from a page off the LRU is
* tricky: page_lock_anon_vma rely on RCU to guard against the races.
*/
struct anon_vma *page_lock_anon_vma(struct page *page)
struct anon_vma *__page_lock_anon_vma(struct page *page)
{
struct anon_vma *anon_vma, *root_anon_vma;
unsigned long anon_mapping;
......@@ -348,6 +348,8 @@ struct anon_vma *page_lock_anon_vma(struct page *page)
}
void page_unlock_anon_vma(struct anon_vma *anon_vma)
__releases(&anon_vma->root->lock)
__releases(RCU)
{
anon_vma_unlock(anon_vma);
rcu_read_unlock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册