Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp613890rdb; Thu, 18 Jan 2024 13:18:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGemyWrNrs8OJIamZuvT+9vm+Yf+5bDp4OVhu7tV2n+84Wvq+4fQ9+IGSjdIKmThJKwjIbf X-Received: by 2002:a05:6a20:ca0:b0:19a:e3e6:7aad with SMTP id dt32-20020a056a200ca000b0019ae3e67aadmr1229708pzb.98.1705612705607; Thu, 18 Jan 2024 13:18:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705612705; cv=pass; d=google.com; s=arc-20160816; b=rgrFT4WBrePMTZcEsvgt67NroigusQTa1O3f8ZUcaJrMllt7st/h3KGRzKarPNMXrE ilhJTILF6mK0NnXbKT8ljvGJgn25sY1De1zUUfgYtdKDUdDQMfs+4B4EttzBmIA11iM2 x6sAZbp5kJqtn8AGi9fqWHRLzeWIUh7qA5ZNghgf3QegS781yezPfiwgGG8ijqvua50I IoioDxUl0coOdaIbR1+q8abyQu+35iGWR0x1XgNose06RCrE0gKK/jc5laitSCaa71Ug jB3IMPhgPgT6jG/U8cycd5S/f5Wj9jy4zaLzQGsHskyydBMBm3lW3z8y5PoMbPcm6Wnf /uXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fIydFx0OSBHgPD2051KnTvD/KFPotO06W3HkqDQgy2s=; fh=n9LeJGVMOdTO6gT8jDI3NjalfxLlA0hcCrYg09vsDEg=; b=wZzeUIBGrurmZm5XthbvBeGaTQw5+n+9vLGGHHWGHsY1nuklK9OZM2ZmI5FJa1jc5H Ou2/0HJdyBjk5ChplyfpFyUAJr9GBX7FEm3EPmXTjfSzMH47t80PE9+0m/zcWsi88No2 +Q3H9QuCBaMCbvWC9FifsjxVnr4Z+Lff9W7F4OUF0P87Jk1DNEooQ9oa7kJIl059Kt/2 hUkDXzGpXjClPEtLt1MmymeHH8Y0xqkBd7VdMWrx5Y0TF4XNLQXwUOPuDNqhsDg3MVHW 1NWkWBNGR+nERRFQ3+ui4BIesKxZatUDoEHMsYnpa4mu+1bVqYvDv280sEQKmViyjHxB 9D1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=eUagBR5W; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-30551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30551-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z10-20020a63e10a000000b005cf5889c470si2025543pgh.322.2024.01.18.13.18.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 13:18:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=eUagBR5W; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-30551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30551-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 60AC1B227AD for ; Thu, 18 Jan 2024 20:15:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 383AA2E82D; Thu, 18 Jan 2024 20:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="eUagBR5W" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 680102E823 for ; Thu, 18 Jan 2024 20:14:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705608895; cv=none; b=fPaGksAdJdlQTTAgyGq65Z7i3Yf369Q9DRSSTUseHhpuuTb+yoGQo5EqSh789AN91qB653l+HBzzX0U0sfIq9FxMJKe1A8UY5vNdWEI3JfdHxLvD+Ktv2NvRXm4GXUNk9xxl9D1elJlTx4zItRJo/gIUQ4HQVqp51NJFYltwhE0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705608895; c=relaxed/simple; bh=LZWv3GLEUX9es9p0Zg0IvfsZJulKGaX4e2YwY5PrDro=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eL1cKsHzU5LbDqnnyOmT0P16PkBF9Akw7ejuTL65rp/ibcn33ZB0Sj6vw+beuCCfFflgM8fIDHSsRc3+7R1MJb2fJ2i5qsAznMpHgPESGJ6jygdzS2+0VQeusSwSMNpWDHhl1utQQCK+eqlomFcydrOf99uUQ1hbkIn3s8Msn1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=eUagBR5W; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fIydFx0OSBHgPD2051KnTvD/KFPotO06W3HkqDQgy2s=; b=eUagBR5W8+3ds2el02+kYSRMO4 sDhrWWjaiJRLFxxONOyP7LGYUIYn1zA0mACvJ6vKOyIuV1WRPj125e8q40TcClO7wXKjN8gbefgt6 wyqOgl0W66laxqFOLAw+B4PnmEsd+3XCswkF4tOHZXVdokHLCoOAGFrHaOh0c0+thbB+a58b2WGOg FABZMQDZhlvN7qQk5bO9U2FWTFYipy2oAPoB6V0SCgdPUNLa4PON8AKXb1sLLD/V9TkyHn6K/9gAc Bj7qiBS8PWWGdMHE36mSfPvpTT7kQfu1RSDiAsnUqXG/CyKw1Xkya011su1JAOgfn42UDvPncZGZ6 Z/O3BByg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rQYmh-0000000323y-3WgP; Thu, 18 Jan 2024 20:14:43 +0000 Date: Thu, 18 Jan 2024 20:14:43 +0000 From: Matthew Wilcox To: Yang Shi Cc: jirislaby@kernel.org, surenb@google.com, riel@surriel.com, cl@linux.com, akpm@linux-foundation.org, yang@os.amperecomputing.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: huge_memory: don't force huge page alignment on 32 bit Message-ID: References: <20240118133504.2910955-1-shy828301@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240118133504.2910955-1-shy828301@gmail.com> On Thu, Jan 18, 2024 at 05:35:04AM -0800, Yang Shi wrote: > It doesn't make too much sense to force huge page alignment on 32 bit > system due to the constrained virtual address space. > > [1] https://lore.kernel.org/linux-mm/CAHbLzkqa1SCBA10yjWTtA2mKCsoK5+M1BthSDL8ROvUq2XxZMw@mail.gmail.com/T/#mf211643a0427f8d6495b5b53f8132f453d60ab95 > [2] https://lore.kernel.org/linux-mm/CAHbLzkqa1SCBA10yjWTtA2mKCsoK5+M1BthSDL8ROvUq2XxZMw@mail.gmail.com/T/#me93dff2ccbd9902c3e395e1c022fb454e48ecb1d I feel sure there are shorter URLs for those messages ... > @@ -811,6 +812,14 @@ static unsigned long __thp_get_unmapped_area(struct file *filp, > loff_t off_align = round_up(off, size); > unsigned long len_pad, ret; > > + /* > + * It doesn't make too much sense to froce huge page alignment on > + * 32 bit system or compat userspace due to the contrained virtual > + * address space and address entropy. > + */ I honestly wouldn't even comment this. But if you must, /* Using THP alignment is not as important as address randomisation */ > + if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall()) > + return 0; > + > if (off_end <= off_align || (off_end - off_align) < size) > return 0; > > -- > 2.41.0 >