From patchwork Mon Mar 27 15:10:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13189519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1AB8C6FD1D for ; Mon, 27 Mar 2023 15:11:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 265FC900004; Mon, 27 Mar 2023 11:11:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 21588900002; Mon, 27 Mar 2023 11:11:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1044A900004; Mon, 27 Mar 2023 11:11:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 01532900002 for ; Mon, 27 Mar 2023 11:11:04 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BFBCF160812 for ; Mon, 27 Mar 2023 15:11:04 +0000 (UTC) X-FDA: 80615016048.04.1395D79 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id E5CF2180021 for ; Mon, 27 Mar 2023 15:11:02 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=UgnhKAWA; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679929863; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=vhbm227ineBmzVC+XQoCFXUGFQbWOGr8axX0SCkCtoM=; b=CwG0nswrWtKM+d4kQbftRip0dbRnNZ6eIxx93cDHtm7J6V52gEYykzGn9RIY3/w6LxZ5Sk DETozmY1oBwAkdx/TO2cC0bXXF4ey2em6/sADmUAqREcHK0uFosqFWavXLFUgFUYzzC2ZV eDSf2HQcTKNuNxm6lTkCEbZYzJdP6lY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=UgnhKAWA; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679929863; a=rsa-sha256; cv=none; b=YIVRPhUtV16KRFNj46xth/SYIAvkAvyaBWts7/t2Jfr06ze9BoiqsNaOBsJzbvUmokr0Xz EToHsDCa0gSOuuG1XP/rHQmY7gfYif2hcjsdnvUkv701N6xwvqBhXeUdzyTWeUVhyWa1R2 ACTadyopd9YWKtJlshyKwjmGxcn7Yeg= 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: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=vhbm227ineBmzVC+XQoCFXUGFQbWOGr8axX0SCkCtoM=; b=UgnhKAWANugZIX3sQQqk5/y9Lv 4+sAzqeZ8X57+fpgWYSa6TD4XwbFQRveXImO+Hqt4qYpyfQnNWqYbA46IWPs5o3nzuhSQeyt6T8de cNkXSJx0UXMj7+DZ4/AwgFYHGzSIyffxN1zz0UgT/AbJ1HpUzuAebiQS9iCDG2vfJPCUAbnoJKaWZ Awf/l+dsGK49IDoH/O8Mn3lffTzTUBKmwZsLY78OIzpcBDUy/UYBcMRkXWdUh12aH2G4xRGAfhi1y dNWoy59x7ugEa4HZ1P3FT5/2T7eF/8xPn6ys4wb8Xt2ntvyHrOqc9vkH3ugeb01qnx+dTtI4BS1ET 2gkVY2DQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pgoUr-007V4t-E7; Mon, 27 Mar 2023 15:10:57 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , Mike Kravetz , Muchun Song , Sidhartha Kumar , linux-mm@kvack.org Subject: [PATCH] hugetlb: Remove PageHeadHuge() Date: Mon, 27 Mar 2023 16:10:50 +0100 Message-Id: <20230327151050.1787744-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Stat-Signature: 1zzgmj7uzook1oo114b6u66z63tyq6te X-Rspam-User: X-Rspamd-Queue-Id: E5CF2180021 X-Rspamd-Server: rspam06 X-HE-Tag: 1679929862-116685 X-HE-Meta: U2FsdGVkX1+F6dQvKWK97D9zUna+gAR7iQ9ePvY2COEAAKrxfWI2mU3F3r+aN7fLiEBKHLwLN4IjzSkwR8GTlhJ5nDZfHQEV1OTgB8EyGDr8AOY4x3rn+bt7wAPzrn5DKqHEh0wcX0xbj1xGP1dJWIsasjpSJal0pNuXnrU91oL3chxN4EHScpYzrCvSk0g3y6J7UhdX0INXiCVdm1EiINvmt9bASoIhhmjjKy3uEa3WpHX06+LR8reSN+ALQueHyHQoENHZ9jZdeX/v6tPTd6paoCZaVDGDCR8PJNMbr0TanycAjtyEPjMQHu8jENFVaFES6lPpKjBtz/JzdRhY0o0fuvdRG+TAAeFwGqMx5P6kdYG1Ck5uzVQ6fDQlSK7d4LPm7vxtllB8Tb/WgZcN+k8kNeU9pLAcopX8Qv+NiMmwnlfujUlmvGY7jN90J+fhcx44hLH51RYu0L7oXr3VivMqWTRZXAj0Y2NiY0YoucFxjW1BvulxYFo3CS1z42bM/uDrGKTO2u3K6QELdelcpa/Qlfu0WkZ7i6+wiYoslbTj0mYKSFBjcxHFprlb8Tzm/wpkY5wbQYiFA4OtqfKX8U6DVce0OMde9+vdkz2N6Hz3z2mvK9RvjOWOd43l5XRrMwoVgEnaLCjZuR/+5YudXP9SGmFQ1PAvOs09CmSOJx6szaOQdk4V9P2WefXAfBMmWib57iCzlZHwPxjDthozTSeLsi/+ZDaXwfIgxn1Z70j3LvkKmtLQkdt+iqZYk2/+6VBIHV5iqc/zZgZSYXN6/1JRLxtjyS9rfyi2Rxunuw5Sqkx+iDlzxD27SWm5lmqglNiuRbpuDNS4f2rxVqxQzx28xLgGMkrIkBrWlyJuKKMNuGiwe88WOCGgL/QSN/spzSvQEKztKT8C3H6tuFykb9qYNUDqfgKCi3wEtDy6m3SHeAH926u+JLjo3uI2QPhnsgfn1+WF0eChPikRVSk LEuWIchg Q/c4xMjfnvU/6XSTHvVwbPzt1x7AiJtU2ycQNbU966EGI4kBjrM6FlYG0v/rxTF4Umr6aYHILaQM3SqRDdm17nLHE/1iLVI/Y9BU1LF7edQkayiPnWOdK350yXMu5NtWFRMAG0Wazp8vUDMvQic3S7sd+8LnZF/P7OBkCDwbzCFZEL9pF0iY5cHcK090JhKI3oUY5 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: Sidhartha Kumar removed the last caller of PageHeadHuge(), so we can now remove it and make folio_test_hugetlb() the real implementation. Add kernel-doc for folio_test_hugetlb(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Sidhartha Kumar Reviewed-by: Mike Kravetz Reviewed-by: David Hildenbrand Reviewed-by: Muchun Song --- include/linux/page-flags.h | 7 +------ mm/hugetlb.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6b3e138613e1..88600a94fa91 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -811,14 +811,9 @@ static inline void ClearPageCompound(struct page *page) #ifdef CONFIG_HUGETLB_PAGE int PageHuge(struct page *page); -int PageHeadHuge(struct page *page); -static inline bool folio_test_hugetlb(struct folio *folio) -{ - return PageHeadHuge(&folio->page); -} +bool folio_test_hugetlb(struct folio *folio); #else TESTPAGEFLAG_FALSE(Huge, hugetlb) -TESTPAGEFLAG_FALSE(HeadHuge, headhuge) #endif #ifdef CONFIG_TRANSPARENT_HUGEPAGE diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4dd722c35a7f..ff686074c481 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2050,19 +2050,23 @@ int PageHuge(struct page *page) } EXPORT_SYMBOL_GPL(PageHuge); -/* - * PageHeadHuge() only returns true for hugetlbfs head page, but not for - * normal or transparent huge pages. +/** + * folio_test_hugetlb - Determine if the folio belongs to hugetlbfs + * @folio: The folio to test. + * + * Context: Any context. Caller should have a reference on the folio to + * prevent it from being turned into a tail page. + * Return: True for hugetlbfs folios, false for anon folios or folios + * belonging to other filesystems. */ -int PageHeadHuge(struct page *page_head) +bool folio_test_hugetlb(struct folio *folio) { - struct folio *folio = (struct folio *)page_head; if (!folio_test_large(folio)) - return 0; + return false; return folio->_folio_dtor == HUGETLB_PAGE_DTOR; } -EXPORT_SYMBOL_GPL(PageHeadHuge); +EXPORT_SYMBOL_GPL(folio_test_hugetlb); /* * Find and lock address space (mapping) in write mode.