diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2016-05-19 20:10:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-19 22:12:14 -0400 |
commit | 0139aa7b7fa12ceef095d99dc36606a5b10ab83a (patch) | |
tree | 94da74f2f79911a11a3c7c34f73ba971dec41a7e /include/linux/pagemap.h | |
parent | 6d061f9f6136d477932088c24ce155d7dc785746 (diff) |
mm: rename _count, field of the struct page, to _refcount
Many developers already know that field for reference count of the
struct page is _count and atomic type. They would try to handle it
directly and this could break the purpose of page reference count
tracepoint. To prevent direct _count modification, this patch rename it
to _refcount and add warning message on the code. After that, developer
who need to handle reference count will find that field should not be
accessed directly.
[akpm@linux-foundation.org: fix comments, per Vlastimil]
[akpm@linux-foundation.org: Documentation/vm/transhuge.txt too]
[sfr@canb.auug.org.au: sync ethernet driver changes]
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Sunil Goutham <sgoutham@cavium.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Manish Chopra <manish.chopra@qlogic.com>
Cc: Yuval Mintz <yuval.mintz@qlogic.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/pagemap.h')
-rw-r--r-- | include/linux/pagemap.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 7e1ab155c67c..fe1513ffb7bf 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -90,12 +90,12 @@ void release_pages(struct page **pages, int nr, bool cold); | |||
90 | 90 | ||
91 | /* | 91 | /* |
92 | * speculatively take a reference to a page. | 92 | * speculatively take a reference to a page. |
93 | * If the page is free (_count == 0), then _count is untouched, and 0 | 93 | * If the page is free (_refcount == 0), then _refcount is untouched, and 0 |
94 | * is returned. Otherwise, _count is incremented by 1 and 1 is returned. | 94 | * is returned. Otherwise, _refcount is incremented by 1 and 1 is returned. |
95 | * | 95 | * |
96 | * This function must be called inside the same rcu_read_lock() section as has | 96 | * This function must be called inside the same rcu_read_lock() section as has |
97 | * been used to lookup the page in the pagecache radix-tree (or page table): | 97 | * been used to lookup the page in the pagecache radix-tree (or page table): |
98 | * this allows allocators to use a synchronize_rcu() to stabilize _count. | 98 | * this allows allocators to use a synchronize_rcu() to stabilize _refcount. |
99 | * | 99 | * |
100 | * Unless an RCU grace period has passed, the count of all pages coming out | 100 | * Unless an RCU grace period has passed, the count of all pages coming out |
101 | * of the allocator must be considered unstable. page_count may return higher | 101 | * of the allocator must be considered unstable. page_count may return higher |
@@ -111,7 +111,7 @@ void release_pages(struct page **pages, int nr, bool cold); | |||
111 | * 2. conditionally increment refcount | 111 | * 2. conditionally increment refcount |
112 | * 3. check the page is still in pagecache (if no, goto 1) | 112 | * 3. check the page is still in pagecache (if no, goto 1) |
113 | * | 113 | * |
114 | * Remove-side that cares about stability of _count (eg. reclaim) has the | 114 | * Remove-side that cares about stability of _refcount (eg. reclaim) has the |
115 | * following (with tree_lock held for write): | 115 | * following (with tree_lock held for write): |
116 | * A. atomically check refcount is correct and set it to 0 (atomic_cmpxchg) | 116 | * A. atomically check refcount is correct and set it to 0 (atomic_cmpxchg) |
117 | * B. remove page from pagecache | 117 | * B. remove page from pagecache |