Received: by 2002:ab2:7104:0:b0:1f7:f6c3:9cb1 with SMTP id z4csp44312lql; Tue, 7 May 2024 09:18:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSijuAHcKr93PycBGk2tJZ6ZQ9WpFJHYOrlSd9gb2trZwXKSc0MaFqbBN1zaEl1K1bDOyBIyhAUBxzC+94djogtIbjL/TcH8eZBFYXLg== X-Google-Smtp-Source: AGHT+IF4JkDA319e1U/YrH/lz7oelvl5FjwDh9ZANRSijnSjVEpT6c+Zy7St3MIRf4n9zK5Z5MQB X-Received: by 2002:a17:902:988c:b0:1e2:6bcd:e64e with SMTP id d9443c01a7336-1eeb059326emr1118995ad.16.1715098713261; Tue, 07 May 2024 09:18:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715098713; cv=pass; d=google.com; s=arc-20160816; b=rm7JwSZIkKhS23pbynREeSvST82v12MMdq53aMA6cT/eVzOyiYySw12E/VvGTChDkW fC++OAj7JWLMLjzI/wnw7u4aI/tacmgj8xMjAn5A5GmDbJfh4u3JqcZ8LHvg9ymaYRQv Fmswbf4IV8sFrF+pRCGN8KuXaAR7T22fPnH7fhBbZBVH2O77htM3bYoWcc0go9stqNfc nkw6TJ2yBtHeIo3lgjqUGwlGWzTd8F+TOyhql12BV6ENid7qJvq/h6sRqt6G96gcf48h /1WiZwkR+EoFIGiWncRrS2hNbzIaRObp2zGIZWvUnSDZJK1pb0L9kxVPkh9KVo8edBPV uvNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=j6vPqeP8YWRohWYEFqRqKvWnxyjBMPw6DQppmYSgey4=; fh=4jiu6T/rW3SS27DAn2C3RZvWQa0C20W3pOZoSxJ4uto=; b=Xlt3SCGepwY+8w8LCSE3nViuADymOPZlABhHyMxjQvF50WFT77ikNBmxzEpJZqxFF0 EvI2vPnt6kfHKtwvHWc9JAo/tp0cthl8oR6vJJ6yx7fvQEJL5qWj2DJr+Ugq6QcPBauq eVb4IaJJv2sDMbmPafU616FSq9vcfi8msczzgV3QHsRuoca6bVY85lcDGX1VzOVrU5Hp O/fYdOA3AkNHtM0m9kMkMrrT180SMvdVhxl6EVp52oihUWq2Dkc/PJj2rTWHu6i30ZvQ WEbZur6IVfC8x11F0iZ0+a4btm4DFbkvpIXGwFH5/2hkOLl9KmzzXmd1Go5ZLMY3sey7 U8TQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-171727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id jd1-20020a170903260100b001e3d56921fasi9136728plb.148.2024.05.07.09.18.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 09:18:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-171727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 50A4FB2585F for ; Tue, 7 May 2024 15:53:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B98316C43E; Tue, 7 May 2024 15:53:16 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4555916ABCE for ; Tue, 7 May 2024 15:53:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715097196; cv=none; b=sbXG/LzSZPPWRUQpKdU6vU7KTe8Q3wy3+6ObfwgIkg6Ekvy1Y9CYFdPTb7U7+XbrhQM8WLgy7ARrbR0fSlX5wcpTPBBqzkDIYJwHKZ9UnA6nb4DDzNrCJzlnRjLczwYoLpXJVsbCUXXZ7XjWk9Q1zaLtUPomqsWNM5TLXt8k85U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715097196; c=relaxed/simple; bh=vplVfclGHUroCOJb/FVNWktJ8JUSw10nffch/n2bgxo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oSf+ppQtmioRZqyy4foF9uNcADHdP1AQuyFVp5AMylHCMaVacHrtf1IaDNUKzpnlz+2IBLgw3bvI1wDvUQ2W30sXKfPpJxmiGIRA02gzFvxaLEsmyV5BHxfy5PPMCniPVzjJprdgpFDTlbQvl2BkebdYzDxQvdfCA9bYUgeo+aI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 817A91063; Tue, 7 May 2024 08:53:39 -0700 (PDT) Received: from [10.1.34.181] (XHFQ2J9959.cambridge.arm.com [10.1.34.181]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3BF1A3F587; Tue, 7 May 2024 08:53:12 -0700 (PDT) Message-ID: <2b403705-a03c-4cfe-8d95-b38dd83fca52@arm.com> Date: Tue, 7 May 2024 16:53:10 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND PATCH] mm: align larger anonymous mappings on THP boundaries Content-Language: en-GB To: Kefeng Wang , David Hildenbrand , Yang Shi Cc: Matthew Wilcox , Yang Shi , riel@surriel.com, cl@linux.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ze Zuo References: <20231214223423.1133074-1-yang@os.amperecomputing.com> <1e8f5ac7-54ce-433a-ae53-81522b2320e1@arm.com> <1dc9a561-55f7-4d65-8b86-8a40fa0e84f9@arm.com> <6016c0e9-b567-4205-8368-1f1c76184a28@huawei.com> <2c14d9ad-c5a3-4f29-a6eb-633cdf3a5e9e@redhat.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 07/05/2024 14:53, Kefeng Wang wrote: > > > On 2024/5/7 19:13, David Hildenbrand wrote: >> >>> https://github.com/intel/lmbench/blob/master/src/lat_mem_rd.c#L95 >>> >>>> suggest. If you want to try something semi-randomly; it might be useful to rule >>>> out the arm64 contpte feature. I don't see how that would be interacting >>>> here if >>>> mTHP is disabled (is it?). But its new for 6.9 and arm64 only. Disable with >>>> ARM64_CONTPTE (needs EXPERT) at compile time. >>> I don't enabled mTHP, so it should be not related about ARM64_CONTPTE, >>> but will have a try. > > After ARM64_CONTPTE disabled, memory read latency is similar with ARM64_CONTPTE > enabled(default 6.9-rc7), still larger than align anon reverted. OK thanks for trying. Looking at the source for lmbench, its malloc'ing (512M + 8K) up front and using that for all sizes. That will presumably be considered "large" by malloc and will be allocated using mmap. So with the patch, it will be 2M aligned. Without it, it probably won't. I'm still struggling to understand why not aligning it in virtual space would make it more performant though... Is it possible to provide the smaps output for at least that 512M+8K block for both cases? It might give a bit of a clue. Do you have traditional (PMD-sized) THP enabled? If its enabled and unaligned then the front of the buffer wouldn't be mapped with THP, but if it is aligned, it will. That could affect it. > >> >> cont-pte can get active if we're just lucky when allocating pages in the right >> order, correct Ryan? >>