Received: by 2002:a05:7208:20d2:b0:82:bbfa:f723 with SMTP id z18csp54130rbz; Tue, 7 May 2024 10:18:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTutvaQT0wmnpIjKGVlwLInYloTylW82QQrROw8MToZTe7WLvEPLDwz537G5uvSpHv3fbeWyUmZZgQc7C86Rp3wceW9XbnQrSwVFdLUg== X-Google-Smtp-Source: AGHT+IF8Uj1MKUAlDAGk+caac3LWN7t5vODZlWUfsXQ80Vxe9vBPi/lBDj54P3c5xS5HCmu+Dd5z X-Received: by 2002:a17:906:c4d:b0:a59:c23d:85d6 with SMTP id a640c23a62f3a-a59fb9db269mr5221266b.57.1715102300110; Tue, 07 May 2024 10:18:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715102300; cv=pass; d=google.com; s=arc-20160816; b=ikESEo33F/InWm2G7tav1+ePQCfG7gARhAcKdYp7TPgJLOtIBbusc1VxeNNTfsZv/e VIR4zJU61tKLpoanHlwZrh2JqZ9F+mp0C+r56Z2frFT3bY+wTc6VKGVendBZZ6iQeVBI Cn1iS4HfOOLgMVC61jfomG0upSUVHiwWAHebf63oKat4TVPuh0iQm8Mi4YoSONq4yIE4 4YlSu1UY5DQGT6mEouz2el81PB1khYr/oxpEVsLQbcQ93sJTRkzEBf+Ro0FrEJjGzWDs UR4EhH45bXE20NOk3Fu80DGMvdiglDVtruNgYt9wGm1VZa2hB/uPI8hUaMudFAqC7+gT 5jiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Wxsc7dN4OIswSJE2MtNAs04aLoVPOnnvcVBuaHnxab0=; fh=l1wzLsBZSd7hB58Vneu2JbqW/QQUUEeQ9sIQGk873zo=; b=n032RkbSgH2MXOfdsd3kW4DfPsI5Hz0vHDY8Uyyqmk45e1WIN/QhA/GusJU60+h9uI WM8Glexc82r2f4RAlBtBUcZs5N7l+eNcFxmflhJesJBOOlPO1a2uZAT/zzdhXUb8TCmX 93rCYfQZiERgi5oWpg/OZudl3kczDj7mZ9pYIf1Z19S3dDfydMzi9qBn1WQxeCkLIqWd zfS2UBpz3H3nUajKmiVeaS2eDRaph54+r8ieoag8IfgQMploolZpMVO+MD/hbSdjdV9Q KMkLaNKztkei84HZZgGJ3KO6nYPp0UIjgu5bdM+7FTzOsPr7oj96dry3cVRnGP+WHLwv xH5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MlvXGbvw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-171905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hr9-20020a1709073f8900b00a59e3d52035si1255858ejc.175.2024.05.07.10.18.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 10:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MlvXGbvw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-171905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 244431F2335E for ; Tue, 7 May 2024 17:18:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E82A168B11; Tue, 7 May 2024 17:17:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MlvXGbvw" Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DAC113D63B for ; Tue, 7 May 2024 17:17:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715102267; cv=none; b=CJn5LXXRVXWhlZk6ZbSIrgDFy+FOts+J40PZzWpEmqSm9Dd+bdawO8iPCl/1MU+BZWso5X3Ltd9tPU+hRCfcg6V/GJeBgbBO7q1RljxiOq4E+bW+RtD+JL6edF1QTp0wHwR7vh9fk9EjgjQV3a+WPv5LS4v+7Eaown+EGcT4NV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715102267; c=relaxed/simple; bh=Wxsc7dN4OIswSJE2MtNAs04aLoVPOnnvcVBuaHnxab0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rKVeuZAJCENgrZSgCp7MAd6f1bzH40llqH31+TNrJsVh8ZZN+bgL5hoj8ZBl/BDgeQgo0rVgb/j2sVMHIukdwF/UyZ0CNrU+PPr53RMTM7YtJhMjqJd8lNFDmr1mnHEKb2ud1+P1HFDwjdm902ussp4cKDtFa25xFGy7oFUUlNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MlvXGbvw; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5206a5854adso2813907e87.0 for ; Tue, 07 May 2024 10:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715102264; x=1715707064; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Wxsc7dN4OIswSJE2MtNAs04aLoVPOnnvcVBuaHnxab0=; b=MlvXGbvw+fdH08WBBnJ58qn6Vv88Ue51FEWVptnWwRDlgbqhOfmcJDNZB9ArVsEqJ5 CCDwOJ6RuOZDaB6xir2zzGs9ASe+/u6dZReYeSqSzq65M/cp/+gw6ydyphUEqV+dU4u+ rLX4tJMcDryic4Di4pkTtYSf66eQq2QrxhXzfa0a3WCJ72UnccfMxBe1z7ffpRHJCeH+ b94tFGQ97TxbqxPa1614huJPzL5orhUjmqKZ/AVZbR6eeUvg6pgy0G9tfDWcWjKrECBB c98gbfYBKeLGp0+m/H2sQk2/o+bekfZAmjS/HURO2iMmS78Sqv59Fyfrfi1sISlixbWm X6fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715102264; x=1715707064; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wxsc7dN4OIswSJE2MtNAs04aLoVPOnnvcVBuaHnxab0=; b=sL1AjPaNxG9yLMvAUIyWGpn0NyQiMHk9xcEsi3o8WQPbstXAu214xV6MfQDMI0vUG9 xGfQOp5BshtO+LC6t9ZRaJ+AfjiRAiaWPjYSI0hSVePitVOUVzoSzCjE5+q3Qv+ZKWoc PMe0F76uCD0IvLYwdVUyIjllROGfTl7Yf+pWXJbzd2HDji3kCotESx4+OedYzQIyz79m V0RdvOtA3seQShOIWu+f+ZKsCYxnvbsy6ZNqaDmg5418QE/Br2+OVZb6Fv16NMYnurOZ Xjn8klsUdMT80A4NTvhZxzTVGhG0tsmE5jDAY7D6MGy7qzTVostK9bffx+tTm4OFfkhd 8lUw== X-Forwarded-Encrypted: i=1; AJvYcCUWmBKmICOf+1IhXazK8XPc63qBADzqc2Unyz6cGaAEaZ09YkWPNfF4iZ/jiaCWzaDBbbqSBfvt4K5zEpCjsxvoiXzYWMNjTNpqABxw X-Gm-Message-State: AOJu0YyrX3+0A+qRk3Fy+F51Dg8VWH4IBkqY5Z4qtMyLP4WIM36qiIwl j2Q1z+/hNGM2TBdGHe6PL1EwM5k2+fqY/5EvXLrulOAqT6KNpHWG+NeJXl5PiHgS33LkqskzJ2g hR4viFFqGZ1uR7UX8abBfX1rLIhE= X-Received: by 2002:ac2:5df1:0:b0:51d:b7fc:29a6 with SMTP id 2adb3069b0e04-5217c3714e9mr124940e87.7.1715102264281; Tue, 07 May 2024 10:17:44 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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> <2b403705-a03c-4cfe-8d95-b38dd83fca52@arm.com> In-Reply-To: <2b403705-a03c-4cfe-8d95-b38dd83fca52@arm.com> From: Yang Shi Date: Tue, 7 May 2024 10:17:32 -0700 Message-ID: Subject: Re: [RESEND PATCH] mm: align larger anonymous mappings on THP boundaries To: Ryan Roberts Cc: Kefeng Wang , David Hildenbrand , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 7, 2024 at 8:53=E2=80=AFAM Ryan Roberts = wrote: > > 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 use= ful to rule > >>>> out the arm64 contpte feature. I don't see how that would be interac= ting > >>>> here if > >>>> mTHP is disabled (is it?). But its new for 6.9 and arm64 only. Disab= le 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 an= d 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. W= ithout > it, it probably won't. I'm still struggling to understand why not alignin= g it in > virtual space would make it more performant though... Yeah, I'm confused too. I just ran the same command on 6.6.13 (w/o the thp alignment patch and mTHP stuff) and 6.9-rc4 (w/ the thp alignment patch and all mTHP stuff) on my arm64 machine, but I didn't see such a pattern. The result has a little bit fluctuation, for example, 6.6.13 has better result with 4M/6M/8M, but 6.9-rc4 has better result for 12M/16M/32M/48M/64M, and the difference may be quite noticeable. But anyway I didn't see such a regression pattern. The benchmark is supposed to measure cache and memory latency, its result strongly relies on the cache and memory subsystem, for example, hw prefetcher, etc. > > Is it possible to provide the smaps output for at least that 512M+8K bloc= k for > both cases? It might give a bit of a clue. > > Do you have traditional (PMD-sized) THP enabled? If its enabled and unali= gned > then the front of the buffer wouldn't be mapped with THP, but if it is al= igned, > it will. That could affect it. > > > > >> > >> cont-pte can get active if we're just lucky when allocating pages in t= he right > >> order, correct Ryan? > >> >