Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1365175
| From | "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/4] mm: introduce struct head_page and compound_head_t |
| Date | 2016-03-27 21:50 +0200 |
| Message-ID | <rhoRc-4ub-21@gated-at.bofh.it> (permalink) |
| References | <rhoRc-4ub-13@gated-at.bofh.it> <rhoRc-4ub-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/4] page-flags: generate page-flags helpers with script "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-27 21:50 +0200 [PATCH 2/4] mm: introduce struct head_page and compound_head_t "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-27 21:50 +0200 [PATCH 3/4] page-flags: make page flag helpers accept struct head_page "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-27 21:50 +0200
csiph-web