lkml.org 
[lkml]   [2016]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/4] mm: introduce struct head_page and compound_head_t
Date
This patch creates new type that is compatible with struct page on
memory layout, but distinct from C point of view.

compound_head_t() has the same functionality as compound_head(), but
returns pointer on struct head_page.

Not-yet-signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
include/linux/mm_types.h | 4 ++++
include/linux/page-flags.h | 9 ++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 944b2b37313b..247e86adaa1c 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -225,6 +225,10 @@ struct page {
#endif
;

+struct head_page {
+ struct page page;
+};
+
struct page_frag {
struct page *page;
#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d111caad2a22..54801253b85c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -133,7 +133,9 @@ enum pageflags {

#ifndef __GENERATING_BOUNDS_H

-struct page; /* forward declaration */
+/* forward declaration */
+struct page;
+struct head_page;

static inline struct page *compound_head(struct page *page)
{
@@ -144,6 +146,11 @@ static inline struct page *compound_head(struct page *page)
return page;
}

+static inline struct head_page *compound_head_t(struct page *page)
+{
+ return (struct head_page *)compound_head(page);
+}
+
static __always_inline int PageTail(struct page *page)
{
return READ_ONCE(page->compound_head) & 1;
--
2.8.0.rc3
\
 
 \ /
  Last update: 2016-03-27 22:21    [W:0.048 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site