From patchwork Wed May 4 20:07:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12838475 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 03A79C433F5 for ; Wed, 4 May 2022 20:08:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFB2A6B0073; Wed, 4 May 2022 16:08:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D99EE6B0075; Wed, 4 May 2022 16:08:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD29E6B007B; Wed, 4 May 2022 16:08:12 -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 8B9C36B0073 for ; Wed, 4 May 2022 16:08:12 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1E8772180A for ; Wed, 4 May 2022 20:08:12 +0000 (UTC) X-FDA: 79429147224.27.035CBFF Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf10.hostedemail.com (Postfix) with ESMTP id 67354C0087 for ; Wed, 4 May 2022 20:07:55 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 467E3B8285D; Wed, 4 May 2022 20:08:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9264DC385A5; Wed, 4 May 2022 20:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651694889; bh=l7eT0YCpeIyaiOA8tAoT/I7aBBJZd/puxtWaxE/qRdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=acTZ0r0HmQrBpAl4JiIkr/1JwQysIT7dA0imdRA0R7z6Dkh2rR/at6yJGFZQqGTFO c7d+q3coF/bfQc8WSQKuUOk6s74cW23NR7bdC36gvxcuqvwL231KtPjgyN67wBkTp7 200vDKxID6Y2z72M4lV1Gk7r6JPVkYZ8SRyzRSgfsdDSAG+eCmkHW4JCXTZ0QPShF/ pbY7jqGrmfDDl6ERfoPW2D10ZFRQ/uu7tDkAZQdUEqP0dkuK6bcSL1GaaMbKY/uKV6 cl6v8ufVOt/8Tieip+Yn703U8wBcnLz7LNPyhd+M0MNcznvsNta/8bx5iFOsOD1sf8 JvBLhJx8HQ/0w== From: SeongJae Park To: akpm@linux-foundation.org, willy@infradead.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH for mm-unstable 2/3] mm/shmem: Use folio_test_transhuge() for THP check Date: Wed, 4 May 2022 20:07:57 +0000 Message-Id: <20220504200758.314478-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220504200758.314478-1-sj@kernel.org> References: <20220504200758.314478-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 67354C0087 X-Stat-Signature: jj35otngx88ytrfaa7nunp7kanhqk191 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=acTZ0r0H; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspam-User: X-HE-Tag: 1651694875-861447 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: Commit 9a44f3462edc ("mm/shmem: convert shmem_add_to_page_cache to take a folio") on 'mm-unstable' replaces 'PageTransHuge()' with 'folio_test_large()' instead of 'folio_test_transhuge()'. This results in below build error when 'CONFIG_TRANSPARENT_HUGEPAGE' is unset. CC mm/shmem.o In file included from : In function ‘shmem_add_to_page_cache’, inlined from ‘shmem_getpage_gfp.isra.0’ at .../linux/mm/shmem.c:1912:10: .../linux/include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_244’ declared with attribute error: BUILD_BUG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ .../linux/include/linux/compiler_types.h:333:4: note: in definition of macro ‘__compiletime_assert’ 333 | prefix ## suffix(); \ | ^~~~~~ .../linux/include/linux/compiler_types.h:352:2: note: in expansion of macro ‘_compiletime_assert’ 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ .../linux/include/linux/build_bug.h:59:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~~~~~~~~~~~~~ .../linux/include/linux/vm_event_item.h:147:27: note: in expansion of macro ‘BUILD_BUG’ 147 | #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; }) | ^~~~~~~~~ .../linux/mm/shmem.c:743:19: note: in expansion of macro ‘THP_FILE_ALLOC’ 743 | count_vm_event(THP_FILE_ALLOC); | ^~~~~~~~~~~~~~ This commit fixes the issue by replacing the check to use 'folio_test_transhuge()'. Fixes: 9a44f3462edc ("mm/shmem: convert shmem_add_to_page_cache to take a folio") Signed-off-by: SeongJae Park --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 6a18641a90ff..3dc34a5a7923 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -739,7 +739,7 @@ static int shmem_add_to_page_cache(struct folio *folio, xas_store(&xas, folio); if (xas_error(&xas)) goto unlock; - if (folio_test_large(folio)) { + if (folio_test_transhuge(folio)) { count_vm_event(THP_FILE_ALLOC); __lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, nr); }