Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933444AbcK2LfE (ORCPT ); Tue, 29 Nov 2016 06:35:04 -0500 Received: from mga09.intel.com ([134.134.136.24]:40220 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757216AbcK2LXd (ORCPT ); Tue, 29 Nov 2016 06:23:33 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,568,1473145200"; d="scan'208";a="906679039" From: "Kirill A. Shutemov" To: "Theodore Ts'o" , Andreas Dilger , Jan Kara , Andrew Morton Cc: Alexander Viro , Hugh Dickins , Andrea Arcangeli , Dave Hansen , Vlastimil Babka , Matthew Wilcox , Ross Zwisler , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv5 15/36] thp: do not threat slab pages as huge in hpage_{nr_pages,size,mask} Date: Tue, 29 Nov 2016 14:22:43 +0300 Message-Id: <20161129112304.90056-16-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161129112304.90056-1-kirill.shutemov@linux.intel.com> References: <20161129112304.90056-1-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1297 Lines: 43 Slab pages can be compound, but we shouldn't threat them as THP for pupose of hpage_* helpers, otherwise it would lead to confusing results. For instance, ext4 uses slab pages for journal pages and we shouldn't confuse them with THPs. The easiest way is to exclude them in hpage_* helpers. Signed-off-by: Kirill A. Shutemov --- include/linux/huge_mm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index e5c9c26d2439..5e6c408f5b47 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -137,21 +137,21 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, } static inline int hpage_nr_pages(struct page *page) { - if (unlikely(PageTransHuge(page))) + if (unlikely(!PageSlab(page) && PageTransHuge(page))) return HPAGE_PMD_NR; return 1; } static inline int hpage_size(struct page *page) { - if (unlikely(PageTransHuge(page))) + if (unlikely(!PageSlab(page) && PageTransHuge(page))) return HPAGE_PMD_SIZE; return PAGE_SIZE; } static inline unsigned long hpage_mask(struct page *page) { - if (unlikely(PageTransHuge(page))) + if (unlikely(!PageSlab(page) && PageTransHuge(page))) return HPAGE_PMD_MASK; return PAGE_MASK; } -- 2.10.2