From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6222DC433DF for ; Mon, 29 Jun 2020 15:20:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 19C10246D3 for ; Mon, 29 Jun 2020 15:20:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="fnydOLav" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19C10246D3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C84586B0070; Mon, 29 Jun 2020 11:20:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C37AF6B0071; Mon, 29 Jun 2020 11:20:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD49D6B0072; Mon, 29 Jun 2020 11:20:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 906F46B0070 for ; Mon, 29 Jun 2020 11:20:17 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4C67A1EE6 for ; Mon, 29 Jun 2020 15:20:17 +0000 (UTC) X-FDA: 76982610474.10.pen37_2115eb726e70 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 833B416A0B9 for ; Mon, 29 Jun 2020 15:20:12 +0000 (UTC) X-HE-Tag: pen37_2115eb726e70 X-Filterd-Recvd-Size: 2870 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Mon, 29 Jun 2020 15:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=C1KD+M2SIQlHhURUdqj/8dc80Kw5CSfLAy8ZHYMHt/A=; b=fnydOLav01bryu6idYY18Yn9Mc DvTgO5l4RBFRsvYfJiefCUc0N+0LPUAYK1UfqBIlio71YhjUquj2kLlMjLxTR/iGIZl0WglbJ719E AV/Oh5sqg4RIicuACr7Tn7Vfmmnuwkrvs8E+vr8PWL53Y3Pq2cRhpJ7s7ik9NNzDGpLYmy6rocMar wWTLwk6qhEl4x1tnkl3PvyxhyBF3SSQM5evxVQIY4EX2zNm4+dUAwQ0M4hAwEaJFAmkqj2A2YJahh obY6eR++aoXAiMSyPEFfCcEJyZslt8OmjlJQRbSq0zLWjY1wT+tmyrvemJC878PNSmHUef54p7K47 d0gBKmOg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpvZp-0004Ca-VN; Mon, 29 Jun 2020 15:20:10 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 6/7] mm: Add thp_head Date: Mon, 29 Jun 2020 16:19:58 +0100 Message-Id: <20200629151959.15779-7-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200629151959.15779-1-willy@infradead.org> References: <20200629151959.15779-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 833B416A0B9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is like compound_head() but compiles away when CONFIG_TRANSPARENT_HUGEPAGE is not enabled. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/huge_mm.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index dcdfd21763a3..bd13e9ac3437 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -266,6 +266,15 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t = *pud, return NULL; } =20 +/** + * thp_head - Head page of a transparent huge page. + * @page: Any page (tail, head or regular) found in the page cache. + */ +static inline struct page *thp_head(struct page *page) +{ + return compound_head(page); +} + /** * thp_order - Order of a transparent huge page. * @page: Head page of a transparent huge page. @@ -342,6 +351,12 @@ static inline struct list_head *page_deferred_list(s= truct page *page) #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) =20 +static inline struct page *thp_head(struct page *page) +{ + VM_BUG_ON_PGFLAGS(PageTail(page), page); + return page; +} + static inline unsigned int thp_order(struct page *page) { VM_BUG_ON_PGFLAGS(PageTail(page), page); --=20 2.27.0