Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1365335

[PATCH 2/2] mm: rename _count, field of the struct page, to _refcount

From js1304@gmail.com
Newsgroups linux.kernel
Subject [PATCH 2/2] mm: rename _count, field of the struct page, to _refcount
Date 2016-03-28 08:00 +0200
Message-ID <rhynw-2Dh-5@gated-at.bofh.it> (permalink)
References <rhynw-2Dh-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Many developer 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.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 include/linux/mm_types.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 944b2b3..9e8eb5a 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -97,7 +97,11 @@ struct page {
 					};
 					int units;	/* SLOB */
 				};
-				atomic_t _count;		/* Usage count, see below. */
+				/*
+				 * Usage count, *USE WRAPPER FUNCTION*
+				 * when manual accounting. See page_ref.h
+				 */
+				atomic_t _refcount;
 			};
 			unsigned int active;	/* SLAB */
 		};
@@ -248,7 +252,7 @@ struct page_frag_cache {
 	__u32 offset;
 #endif
 	/* we maintain a pagecount bias, so that we dont dirty cache line
-	 * containing page->_count every time we allocate a fragment.
+	 * containing page->_refcount every time we allocate a fragment.
 	 */
 	unsigned int		pagecnt_bias;
 	bool pfmemalloc;
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] mm/page_ref: use page_ref helper instead of direct modification of _count js1304@gmail.com - 2016-03-28 08:00 +0200
  [PATCH 2/2] mm: rename _count, field of the struct page, to _refcount js1304@gmail.com - 2016-03-28 08:00 +0200
    Re: [PATCH 2/2] mm: rename _count, field of the struct page, to  _refcount kbuild test robot <lkp@intel.com> - 2016-03-28 08:10 +0200
      Re: [PATCH 2/2] mm: rename _count, field of the struct page, to _refcount Joonsoo Kim <js1304@gmail.com> - 2016-03-28 08:30 +0200
    Re: [PATCH 2/2] mm: rename _count, field of the struct page, to _refcount Joonsoo Kim <js1304@gmail.com> - 2016-03-28 08:10 +0200
    Re: [PATCH 2/2] mm: rename _count, field of the struct page, to  _refcount kbuild test robot <lkp@intel.com> - 2016-03-28 08:20 +0200

csiph-web