From patchwork Fri Jul 12 15:58:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 13731929 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 2BAF5C2BD09 for ; Fri, 12 Jul 2024 15:59:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B07E86B0096; Fri, 12 Jul 2024 11:59:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB9256B0098; Fri, 12 Jul 2024 11:59:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90BBF6B0099; Fri, 12 Jul 2024 11:59:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7015F6B0096 for ; Fri, 12 Jul 2024 11:59:25 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1E7C2160BD1 for ; Fri, 12 Jul 2024 15:59:25 +0000 (UTC) X-FDA: 82331560290.22.81B1798 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2109.outbound.protection.outlook.com [40.107.237.109]) by imf25.hostedemail.com (Postfix) with ESMTP id DDE98A0009 for ; Fri, 12 Jul 2024 15:59:21 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=os.amperecomputing.com header.s=selector2 header.b="Q5BU/txJ"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf25.hostedemail.com: domain of yang@os.amperecomputing.com designates 40.107.237.109 as permitted sender) smtp.mailfrom=yang@os.amperecomputing.com; dmarc=pass (policy=quarantine) header.from=amperecomputing.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720799928; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=m6xTkbfCKHtPsLO9wNV8wJbADLLHwaAOm6JsLtOK1q0=; b=CkuvLZV3lzj5Q1byb3wJA9gEaRXc151xr2IMDCfzdKUbh5UuxpNvb2z6Ij1iRKlLaCWWdY 5Q0vV5yCXjyCGzW3GRzw/Wgsl72BznEiK8hfvgH0gzxLG3IWYm3Vq0IGmkvV0e/+O9SueR Xng96xVgds864IZpESTZqiatLo0JIJs= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1720799928; a=rsa-sha256; cv=pass; b=m92fR/DmuOJM42JnATvUxVPnm6xNGfpOYXwKsHvMsfNrmAfhpYIyxTK6CAdJ+e/mufoLNF sgbjCxkloLtzqvULSzFaD/fcSJk/YTYO1tIJbwuhhG5OmyA196ArkphLNCL8H6cdSt13Yd 0HOxNDXWq999hT5u+L7ohQB/rqw+8zo= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=os.amperecomputing.com header.s=selector2 header.b="Q5BU/txJ"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf25.hostedemail.com: domain of yang@os.amperecomputing.com designates 40.107.237.109 as permitted sender) smtp.mailfrom=yang@os.amperecomputing.com; dmarc=pass (policy=quarantine) header.from=amperecomputing.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pqpJ+KnlghOLt99Rw7fvCBXS34cJ/nY8HKXX8QBUymIQ04wYc1banI+XuFMjIVPdp0DEoeXKtCJTBY21adoujoEP4AJXTXoRkarIKrdj8Nw2y1GuVINWmRXLCZACLhTxDfYA+T1rlvMrrHoEGsUisxPdAXd62WBKfKvASrkN8g+oHG7m15xiDrJZqDtHgnlFJLb8Qm2tjT9rYNWpN7vwccGc8xE8Y3S8Z+kTqnaZzddwf1GTy1Fr2Qxc2BjtCARqYPICJs/cOnhrHt2S64Hw0SskSowplL67kMS19RWwBp+ACDJPw9v/WMX/hCPcVN4VlAsxpKY5Ec7qKecEtg6YIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m6xTkbfCKHtPsLO9wNV8wJbADLLHwaAOm6JsLtOK1q0=; b=AHVBkIs0nzEt2b0pkGqNq1eq1Hx0dSsGyl1vj5rEquE56othST6T7prOkkERsvzbVBg2LiSTYl/lv/3RwZtvjnej8uGLLaWHK5zP62G5A41dii7FuV+htkvAcD73yX7NH+UQJ6cFU2iV5FXEzEU+UOTVmN4/3OVmjPl8ludJtF2t2gkspb9DRBw6lKqFVZ7V6Eb9tYc64q7DWDVOnpVsYodkb58ZATb4jHWbXO7A2NR6KzJuo6pik2Kfc/DlaxgJ0AZXzH2Ik8/5ftpMDimzL9tcrVtJ/d3bv5ktczlBCGPlhn7f42UmL266dechX/eWI2BzLt1dgXMopc3DYM0OIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m6xTkbfCKHtPsLO9wNV8wJbADLLHwaAOm6JsLtOK1q0=; b=Q5BU/txJFxToyFu9tyH+Mw3Azg4McnsAr4abSrtiW+RdCQuuA6liZ+1W75queLpqxeWHzEB32PjO+5O5OmNqsa1JF1cl6ykoNAxWD4BHnBZlUFhC2sL1jIXpi5NxNtwQ7k+Cu6OyBpooMYhpGQCvT/K81EsUV9sA7SpYYTp/X9c= Received: from MN2PR01MB5471.prod.exchangelabs.com (2603:10b6:208:11b::13) by PH0PR01MB8070.prod.exchangelabs.com (2603:10b6:510:295::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Fri, 12 Jul 2024 15:59:12 +0000 Received: from MN2PR01MB5471.prod.exchangelabs.com ([fe80::dba1:7502:f7ff:3f80]) by MN2PR01MB5471.prod.exchangelabs.com ([fe80::dba1:7502:f7ff:3f80%7]) with mapi id 15.20.7762.020; Fri, 12 Jul 2024 15:59:12 +0000 From: Yang Shi To: corsac@debian.org, willy@infradead.org, jirislaby@kernel.org, surenb@google.com, riel@surriel.com, cl@linux.com, carnil@debian.org, ben@decadent.org.uk, akpm@linux-foundation.org Cc: yang@os.amperecomputing.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] mm: huge_memory: use !CONFIG_64BIT to relax huge page alignment on 32 bit machines Date: Fri, 12 Jul 2024 08:58:55 -0700 Message-ID: <20240712155855.1130330-1-yang@os.amperecomputing.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: CH0PR03CA0313.namprd03.prod.outlook.com (2603:10b6:610:118::34) To MN2PR01MB5471.prod.exchangelabs.com (2603:10b6:208:11b::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR01MB5471:EE_|PH0PR01MB8070:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cad084f-0dca-4ea0-3413-08dca28b921b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|7416014|376014|1800799024|38350700014; X-Microsoft-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zKhzEkk28bakMhPpSE/bZe6T3Lwlo8Sd9oTPU8y+mX0tMCioBuxOE0F3V5l7lHLzb50PIegTAfLmbFzFB2nJfFWpyF4exEUIQ+fMkMGR1g3Her0mSlnp+kQAb0cv6yDE/nMZdhPHE3rrIK/O3vnJehgdbI0+OGw1C6KzQpQH7XneyrHbixrcxRlSfDOLAYktcBLfSpxGS368ea9EgikqmP2hyX3nZfelAFVBTpAkk4dPu7XHqLtuHd23cZbkWh2yvzGnckoColtHNBDepwaR69VB7T2zeBxSOOfQHhE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR01MB5471.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U4DlLOuWwDbuxw+Le71Xiio+SO2z1160fPtX1zqrYHaKwr076dQ1BaNRAfs9qGCp5AHxgvfZm+i69i4g5M0ASFDXCOQoDaSPS8CB/0ElYWc7yEKll1VpL/kp5QSJcp/YZgkXWFKRKSXpzkEZCGH0u9Lp2pq3jfo8ssgW2afSNuWSknkySbfHlrQz6q9yATjF/D61MW+miQYSMO2y7cmhi+TcGGjWB0kPhUV1MJ59bs1BF/jFcZrCngCMr2YOyTCVNIQXCmSd4/11y7g0VXXk7CydqkXWH98ZY7JC8VXUwArwvMEY4Z6tsYC5InI9GTkzzDgjDnHQwRLCBG65pQSZLMCLSV9BkwZTvm2R6F+vA3KsRsUz2PYQ7dKkQrogFXdVRiU9zHyh5+LEEtrqOACucfaZkjhV2K8k6uNFnE3l58IVYptWgtNgVv6rfACwrkYrF1SHeapNEo6SvwrzFGBBrE7l4pzvYxr2H9pQ8jWa/Vq0BSPWnj0a/cl4fWyEV92cpYmr1yEq2kC/ecSmV1YOLbZlGdMYyW0CWvZ1Cx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DqJUklytK8= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cad084f-0dca-4ea0-3413-08dca28b921b X-MS-Exchange-CrossTenant-AuthSource: MN2PR01MB5471.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 15:59:12.4443 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4RMN5p0BTSd93bsOosD15ba3QU+zoN7WlgSADaPQReCV1r/U813IBZ8K4/MPKOL7sA+ASADPp0fCwtUxvPV+wZmmCFLWc9DtqgsqCHkgvS0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB8070 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DDE98A0009 X-Stat-Signature: txic4gssdiq73et8ycea7whq68gn1cuf X-HE-Tag: 1720799961-742017 X-HE-Meta: U2FsdGVkX19kOZk2wh8wGZBqtUs23/fCZsBx/1Q01O/aqsFZOkkvaXBQ/3FpeXJ9i1JAAtIG71bTbqyUFkfTuo4BCRE4SaSJxNiQoD5rCY7tzNGVz6CKi//IAk3pIByZtmeGBW8ijx1TOQ8JNSRf7HfZvBJzjeTBNMgO6IoYfejE8EfIdWdVjOCY1MFJUl4t1pb7huMbmdaRJAieNc5NeQgsxfXh19Buxt3rOP6qvp4nRTRBRD9NethFDU+W//TImHCxgMnxXmQijTSmZL5buTsrxhYX6G276hvUHURXDNdNo0DD1SyN7uO53hl0A0FOVhNnRwuEFIgBJpmz/Gda6vBNSm8wqw9rlOqLhS0o5fctPbfkeoP+N9s9P4SZwkOeCKJ3LTxPgblO3l0ke5RW0+bwQBDyaPf96u9n43JVBlZyZCKWUad05ls6QcgjpOVcxv37Zjctxg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ee7SvFd48u4lmS3dLlWhPphuFO51zmWn6T4aAR/Ot8ziX6HFhWKDBJ0LN5yhX3FKsj8tai3Z/CS955Bh1nloc002Yg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000415, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Yves-Alexis Perez reported commit 4ef9ad19e176 ("mm: huge_memory: don't force huge page alignment on 32 bit") didn't work for x86_32 [1]. It is because x86_32 uses CONFIG_X86_32 instead of CONFIG_32BIT. !CONFIG_64BIT should cover all 32 bit machines. [1] https://lore.kernel.org/linux-mm/CAHbLzkr1LwH3pcTgM+aGQ31ip2bKqiqEQ8=FQB+t2c3dhNKNHA@mail.gmail.com/ Fixes: 4ef9ad19e176 ("mm: huge_memory: don't force huge page alignment on 32 bit") Reported-by: Yves-Alexis Perez Tested-By: Yves-Alexis Perez Cc: [6.8+] Signed-off-by: Yang Shi Acked-by: David Hildenbrand --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 2120f7478e55..64f00aedf9af 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -857,7 +857,7 @@ static unsigned long __thp_get_unmapped_area(struct file *filp, loff_t off_align = round_up(off, size); unsigned long len_pad, ret, off_sub; - if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall()) + if (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall()) return 0; if (off_end <= off_align || (off_end - off_align) < size)