From nobody Fri May 8 10:46:05 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD2D8C433FE for ; Wed, 4 May 2022 20:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357948AbiEDULs (ORCPT ); Wed, 4 May 2022 16:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbiEDULq (ORCPT ); Wed, 4 May 2022 16:11:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC91220E9 for ; Wed, 4 May 2022 13:08:09 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 099636156B for ; Wed, 4 May 2022 20:08:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E35D0C385AE; Wed, 4 May 2022 20:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651694888; bh=hP6DONQx8HT3ciq95qC7cLt2aYlwi23SKeG+VbaD1mM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TF4t+dOV6Kb8lkG8GJVR1PoreKUgXBn1VlnhrosNyEUKEbZ2MTsmJ+gYBjVpiXxzU Co9ZOCrpB4hXv7plOP34gvW0o7zI+bFt5qo+Kskv+ZtZ6fDPkT4zuVAUoZ13hS2C8A daRPV2DIU6FPf6wqxyGgAuXWGDR38+AXruvoORNQ6F1E1CMLT3NgiKbG4grAT2zfe/ vNue9Hrsixh9TsMHC5NUd7vzr6d5IbkDzfWWDDd7i2oWheN23VVKbNuHBrMRzFcGPQ f4+B9l3P20s2k7J2aADAwQ274Q1C3JV1HceRzSzR5qJkUSRgiB0yLf5fW9z9LhLAqu Ta725knLj9gDg== 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 1/3] mm/vmscan: Use folio_test_transhuge() for THP check Date: Wed, 4 May 2022 20:07:56 +0000 Message-Id: <20220504200758.314478-2-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 22bf1b68e572 ("vmscan: remove remaining uses of page in shrink_page_list") 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/vmscan.o In file included from : In function =E2=80=98can_split_folio=E2=80=99, inlined from =E2=80=98shrink_page_list=E2=80=99 at .../linux/mm/vms= can.c:1719:11: .../linux/include/linux/compiler_types.h:352:38: error: call to =E2=80= =98__compiletime_assert_178=E2=80=99 declared with attribute error: BUILD_B= UG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^ .../linux/include/linux/compiler_types.h:333:4: note: in definition of = macro =E2=80=98__compiletime_assert=E2=80=99 333 | prefix ## suffix(); \ | ^~~~~~ .../linux/include/linux/compiler_types.h:352:2: note: in expansion of m= acro =E2=80=98_compiletime_assert=E2=80=99 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^~~~~~~~~~~~~~~~~~~ .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro = =E2=80=98compiletime_assert=E2=80=99 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 = =E2=80=98BUILD_BUG_ON_MSG=E2=80=99 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~~~~~~~~~~~~~ .../linux/include/linux/huge_mm.h:351:2: note: in expansion of macro = =E2=80=98BUILD_BUG=E2=80=99 351 | BUILD_BUG(); | ^~~~~~~~~ This commit fixes the issue by replacing the check to use 'folio_test_transhuge()'. Fixes: 22bf1b68e572 ("vmscan: remove remaining uses of page in shrink_page_= list") Signed-off-by: SeongJae Park --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 40cda196d802..5a0f081a7be5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1714,7 +1714,7 @@ static unsigned int shrink_page_list(struct list_head= *page_list, goto keep_locked; if (folio_maybe_dma_pinned(folio)) goto keep_locked; - if (folio_test_large(folio)) { + if (folio_test_transhuge(folio)) { /* cannot split folio, skip it */ if (!can_split_folio(folio, NULL)) goto activate_locked; --=20 2.25.1 From nobody Fri May 8 10:46:05 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69992C433EF for ; Wed, 4 May 2022 20:08:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377841AbiEDULx (ORCPT ); Wed, 4 May 2022 16:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358047AbiEDULt (ORCPT ); Wed, 4 May 2022 16:11:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2CBE220DA for ; Wed, 4 May 2022 13:08:11 -0700 (PDT) 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 6976FB828AB for ; 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =E2=80=98shmem_add_to_page_cache=E2=80=99, inlined from =E2=80=98shmem_getpage_gfp.isra.0=E2=80=99 at .../linu= x/mm/shmem.c:1912:10: .../linux/include/linux/compiler_types.h:352:38: error: call to =E2=80= =98__compiletime_assert_244=E2=80=99 declared with attribute error: BUILD_B= UG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^ .../linux/include/linux/compiler_types.h:333:4: note: in definition of = macro =E2=80=98__compiletime_assert=E2=80=99 333 | prefix ## suffix(); \ | ^~~~~~ .../linux/include/linux/compiler_types.h:352:2: note: in expansion of m= acro =E2=80=98_compiletime_assert=E2=80=99 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^~~~~~~~~~~~~~~~~~~ .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro = =E2=80=98compiletime_assert=E2=80=99 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 = =E2=80=98BUILD_BUG_ON_MSG=E2=80=99 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 m= acro =E2=80=98BUILD_BUG=E2=80=99 147 | #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; }) | ^~~~~~~~~ .../linux/mm/shmem.c:743:19: note: in expansion of macro =E2=80=98THP_F= ILE_ALLOC=E2=80=99 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 f= olio") 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); } --=20 2.25.1 From nobody Fri May 8 10:46:05 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C634C433EF for ; Wed, 4 May 2022 20:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377840AbiEDULz (ORCPT ); Wed, 4 May 2022 16:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358149AbiEDULt (ORCPT ); Wed, 4 May 2022 16:11:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B73220D5 for ; Wed, 4 May 2022 13:08:12 -0700 (PDT) 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 E62ACB828A5 for ; Wed, 4 May 2022 20:08:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4141BC385B1; Wed, 4 May 2022 20:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651694889; bh=CGUidupZKZlTBIzgz45tkTfw8MnXPRqOctPSPdF1FH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6z3UyTfDkC0XihPAQhouzs84LPDo5VJkIKLL9wAS7RfOiAy30FofvfXKz9I5Mmp7 BGVfTInSZnNjpRLyzN0TFlDMBWwY4c9sLXDYYAeBQLit32p8Yw+HYE1lMcr6cD09P2 +wUT5K992LOlny6psv6sqsvFo99x2kdBVHw9W3BpA89ahM2CWw3cWQ7bSAL8CC/Ww7 maMrMISYQT5NdfGmui/vYh1AIsYwr6lTRFG/HvsAu3GUJZpTdFy46YU2Es4hR5hcXh 9bFKeYbiaGQpLepoqbDH4+Yh1DsbGOX3L8ovHCvGfHhvsMhDC8AtN41XKhXPb9na/N NWLiV1aJk/4fg== 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 3/3] mm/shmem: Use folio_test_transhuge() for THP check Date: Wed, 4 May 2022 20:07:58 +0000 Message-Id: <20220504200758.314478-4-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 94cdf3e8c0bf ("mm/shmem: convert shmem_getpage_gfp to use 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 .../linux/include/linux/kernel.h:25, from .../linux/arch/x86/include/asm/percpu.h:27, from .../linux/arch/x86/include/asm/preempt.h:6, from .../linux/include/linux/preempt.h:78, from .../linux/include/linux/spinlock.h:55, from .../linux/include/linux/wait.h:9, from .../linux/include/linux/wait_bit.h:8, from .../linux/include/linux/fs.h:6, from .../linux/mm/shmem.c:24: .../linux/mm/shmem.c: In function =E2=80=98shmem_getpage_gfp.isra.0=E2= =80=99: .../linux/include/linux/compiler_types.h:352:38: error: call to =E2=80= =98__compiletime_assert_252=E2=80=99 declared with attribute error: BUILD_B= UG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^ .../linux/include/linux/math.h:15:46: note: in definition of macro =E2= =80=98__round_mask=E2=80=99 15 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | ^ .../linux/mm/shmem.c:1900:12: note: in expansion of macro =E2=80=98roun= d_down=E2=80=99 1900 | hindex =3D round_down(index, HPAGE_PMD_NR); | ^~~~~~~~~~ .../linux/include/linux/compiler_types.h:340:2: note: in expansion of m= acro =E2=80=98__compiletime_assert=E2=80=99 340 | __compiletime_assert(condition, msg, prefix, suffix) | ^~~~~~~~~~~~~~~~~~~~ .../linux/include/linux/compiler_types.h:352:2: note: in expansion of m= acro =E2=80=98_compiletime_assert=E2=80=99 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^~~~~~~~~~~~~~~~~~~ .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro = =E2=80=98compiletime_assert=E2=80=99 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 = =E2=80=98BUILD_BUG_ON_MSG=E2=80=99 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~~~~~~~~~~~~~ .../linux/include/linux/huge_mm.h:307:28: note: in expansion of macro = =E2=80=98BUILD_BUG=E2=80=99 307 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) | ^~~~~~~~~ .../linux/include/linux/huge_mm.h:105:26: note: in expansion of macro = =E2=80=98HPAGE_PMD_SHIFT=E2=80=99 105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ^~~~~~~~~~~~~~~ .../linux/include/linux/huge_mm.h:106:26: note: in expansion of macro = =E2=80=98HPAGE_PMD_ORDER=E2=80=99 106 | #define HPAGE_PMD_NR (1<: .../linux/include/linux/compiler_types.h:352:38: error: call to =E2=80= =98__compiletime_assert_253=E2=80=99 declared with attribute error: BUILD_B= UG failed 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^ .../linux/include/linux/compiler_types.h:333:4: note: in definition of = macro =E2=80=98__compiletime_assert=E2=80=99 333 | prefix ## suffix(); \ | ^~~~~~ .../linux/include/linux/compiler_types.h:352:2: note: in expansion of m= acro =E2=80=98_compiletime_assert=E2=80=99 352 | _compiletime_assert(condition, msg, __compiletime_assert_, __C= OUNTER__) | ^~~~~~~~~~~~~~~~~~~ .../linux/include/linux/build_bug.h:39:37: note: in expansion of macro = =E2=80=98compiletime_assert=E2=80=99 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 = =E2=80=98BUILD_BUG_ON_MSG=E2=80=99 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") | ^~~~~~~~~~~~~~~~ .../linux/include/linux/huge_mm.h:307:28: note: in expansion of macro = =E2=80=98BUILD_BUG=E2=80=99 307 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) | ^~~~~~~~~ .../linux/include/linux/huge_mm.h:105:26: note: in expansion of macro = =E2=80=98HPAGE_PMD_SHIFT=E2=80=99 105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ^~~~~~~~~~~~~~~ .../linux/include/linux/huge_mm.h:106:26: note: in expansion of macro = =E2=80=98HPAGE_PMD_ORDER=E2=80=99 106 | #define HPAGE_PMD_NR (1< --- mm/shmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 3dc34a5a7923..c51d3532c962 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1888,7 +1888,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgo= ff_t index, goto unlock; } =20 - if (folio_test_large(folio)) + if (folio_test_transhuge(folio)) hindex =3D round_down(index, HPAGE_PMD_NR); else hindex =3D index; @@ -1910,7 +1910,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgo= ff_t index, spin_unlock_irq(&info->lock); alloced =3D true; =20 - if (folio_test_large(folio) && + if (folio_test_transhuge(folio) && DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE) < hindex + HPAGE_PMD_NR - 1) { /* @@ -1973,7 +1973,7 @@ static int shmem_getpage_gfp(struct inode *inode, pgo= ff_t index, unacct: shmem_inode_unacct_blocks(inode, folio_nr_pages(folio)); =20 - if (folio_test_large(folio)) { + if (folio_test_transhuge(folio)) { folio_unlock(folio); folio_put(folio); goto alloc_nohuge; --=20 2.25.1