From patchwork Mon Jun 29 15:19:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11631129 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1685618 for ; Mon, 29 Jun 2020 15:20:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BE6EE246D3 for ; Mon, 29 Jun 2020 15:20:23 +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 BE6EE246D3 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C37AF6B0071; Mon, 29 Jun 2020 11:20:17 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,bb333f3e5ad3e63f,d41d8cd98f00b204,willy@infradead.org,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2731:3138:3139:3140:3141:3142:3352:3865:3866:3870:3871:4321:5007:6261:6653:7875:8957:10004:11026:11473:11658:11914:12043:12296:12297:12438:12555:12895:12986:13069:13311:13357:13894:14096:14181:14384:14394:14721:21080:21451:21627:21990:30054,0,RBL:90.155.50.34:@infradead.org:.lbl8.mailshell.net-64.201.201.201 62.8.15.100;04yrowamfu718cgdr3h6q7xzk54gfocmopsety6hy19eyqy7w9ubwec7xpkftbc.3kurug4c3uxr6p4zqrahydq1i5f6hdepboik5sm8mz7yy7odnemuzokeqd3guup.c-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none 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 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; } +/** + * 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(struct page *page) #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) +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);