Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753369AbcC0Ts3 (ORCPT ); Sun, 27 Mar 2016 15:48:29 -0400 Received: from mga04.intel.com ([192.55.52.120]:41985 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752687AbcC0Tru (ORCPT ); Sun, 27 Mar 2016 15:47:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,402,1455004800"; d="scan'208";a="74120625" From: "Kirill A. Shutemov" To: Eric Biggers Cc: Hugh Dickins , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" Subject: [PATCH 2/4] mm: introduce struct head_page and compound_head_t Date: Sun, 27 Mar 2016 22:47:38 +0300 Message-Id: <1459108060-69891-2-git-send-email-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1459108060-69891-1-git-send-email-kirill.shutemov@linux.intel.com> References: <20160327194649.GA9638@node.shutemov.name> <1459108060-69891-1-git-send-email-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1545 Lines: 56 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 --- 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