Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2555129rdb; Mon, 12 Feb 2024 08:28:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkLB9WT3DaRFTi8Zn3Zce4It7an0s+XffplD2FtWb+Ewtciil0JwVY4Xu13HXeTlUK2poB X-Received: by 2002:a17:902:ebc5:b0:1db:2ab0:f3de with SMTP id p5-20020a170902ebc500b001db2ab0f3demr351800plg.13.1707755295579; Mon, 12 Feb 2024 08:28:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755295; cv=pass; d=google.com; s=arc-20160816; b=Y9QDXrZA/JdXo2iLWl1x156+BN1n5EntgTPSDE01ionZ4Pr8shQ7XF02PAHWS6UG9h ko3bspaZ5muZdql0sztuRr76oAuJFTTXavkZGWiV9kLW4XewMWPldxn4soqpecpvjrif j1mfKGBnwSiVFn3tFZIk8NRqJjXlnONrRX6r2jIjxize22oomhKi0W6yS3NWlRM88grr +n08BPWriSjmlQXzeQUUUIHU5V1JL7U9kYK3Q1MDDS5M+YA0hdHhRn9faJhQF6DPbiLh PilN12ZrUIDGoAGwT0T0YXhoLCdenIFgxtKm5l8OSeUF7t+z/gII2iek5Ko165CSvtg0 fATA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=u9+rwPAvqYLW6lsheKf2xHocBNG2KMyghJEaP/POFlg=; fh=p+fXnJ9GBk5md5x+/d9vxvdHf17OzktFNy/MC9itRhE=; b=qYAIdz9ILowbBCFsmDuZNY95QARBMnjVTnOWtgp3bvvUHCAvShQLPxyFWiGZymKQdp 2+EW24K7V1bRCkA5+EddGSoCT1Wzmty7myC/r3uBziP+7qv6moS4oLjJ5h7sCYB8An9G fhYR0oym2arWKgKMsW+8x0d5921aYcCd8CyQqalifEFf/q3wl4O3nQ8cCxzUmXouQeGy 141AahUy2B7xHv8DPtrdz4zV2XpAndQDAsrGQALeCcGxR2BuAQyK5LswzkpMzbskkIq5 ICYPU3JtRRxvx49HGoho94jZciYza3dsyppmBCoIocRevXvDSAoJZ3zFwAvm1cuY98ca 63QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IKFhS7jI; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-61954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCXmVLA7cfVjUutlBZyp3iQvSmbwytushnnxqV1m2FLgO496Sr/uJ+S90vJHuO/Hq1TpAyPFR2Df5awSIgSgq1+FsygnrURqZu6wRFfNIQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u14-20020a170903124e00b001d44769173fsi453803plh.245.2024.02.12.08.28.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:28:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IKFhS7jI; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-61954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3D6FA281ACD for ; Mon, 12 Feb 2024 16:28:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD16E3D3A2; Mon, 12 Feb 2024 16:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IKFhS7jI" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 131A53D0D1 for ; Mon, 12 Feb 2024 16:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755287; cv=none; b=SK6Tapq1kFnqdxUWs5cXsrfqf0sFxmncT6r3GE0LdwUPkYMqmOEZ7Hiv9gSnWkwNa2mR7Y/31T/9uNM8omrtiduVb0TB7jOwPKFO+IyP5RWc7Fr9af+0avqKvl9b98+PYvobnX+PF62yYtg2dXDeLqHlDNLi6+qhAOrwJKW24OE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755287; c=relaxed/simple; bh=D9tcyPi9DY41WzSj/eaj8RIRjLwzxRFUIql1Tt/pXnc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=frA+9yKM7JHNia4UUTtBc12RSCggQNhtIPOG4XXbrO2CIm+rqzKjhGYEZeW35RWeQdqu0pgQb0XO9zHPUAdL/MI7lrb6CD1N/PTCxYcH5oYUyrF7QqASk0728Z0ym9H1zGg/VkXs70//JlW5BcNtcOG/z46ouVV9Xl0j3fx9ad8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=IKFhS7jI; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707755284; h=from:from: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:in-reply-to:references:references:autocrypt:autocrypt; bh=u9+rwPAvqYLW6lsheKf2xHocBNG2KMyghJEaP/POFlg=; b=IKFhS7jI8r0M5sz+p8ecJOnzH6aAhzkkw0AWjOvcjRfOTRWFnxJdM1enQExJdbsJO8f0fK vDee9F4WLrmTO97IBVPAnuMlKojmyMcffSSFMsda9vN8zfbGGFCk2TH/bTtCJomEAfH/q6 Md9vqa1XQ/3c4qgldWeptKeWJCEf0Ec= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-421-T_byWcCzNOS9deHmdHrAaQ-1; Mon, 12 Feb 2024 11:28:03 -0500 X-MC-Unique: T_byWcCzNOS9deHmdHrAaQ-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2d0aafebedbso28007481fa.1 for ; Mon, 12 Feb 2024 08:28:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707755282; x=1708360082; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=u9+rwPAvqYLW6lsheKf2xHocBNG2KMyghJEaP/POFlg=; b=JYIbxa5pmgA8XW5fGDPoVzU5WAuTqMAkDSOgFsSOMP2fvoLawEmjIYrjNv2i4SuM/x FVJB5zk+t5WiaxnfGeu8ofb0G+gNboDBvrVNQicFq7dWq/7qHGDUDCf9Dtn/KYtmsrdI KevMiAAumMEIwEVO4oRZqBiUIGm3+gFoywk5R/BGDRphACcQ73uDttObEFDupr0caKLx J+3YZO6PjL72FEGQ9sP3NX8o/jIdAXpKmeh99LT3+yUBCJ5lf1MpL2zKALCZI438bDm0 mPcM1mDNS1/G2u9EcTJg8Q0WiBQNPN9G9S5Mj9EDqVMQXjk2GqMA8IJjVKIWL5Eh+SL0 KD0w== X-Gm-Message-State: AOJu0Yz2gytMLrf5d+xcRyPWTi55C5BbnFxOof9ZuZKIZFDfwyC/9GF7 6rY1LQUvYZqZpgskIDxbDMjKJ1AbJhmCTfe9RW6kz4XX0f3mx22sNKzSD+H27GRuX0CQboMBx8L O4gJx4HQgTIPUwFRYXKE5WJt100Q6Hxy4q+ACF3XUo3rxUsGRJWjVA58Gh4bC9A== X-Received: by 2002:a05:6512:2821:b0:511:80b2:ed55 with SMTP id cf33-20020a056512282100b0051180b2ed55mr4831671lfb.59.1707755281928; Mon, 12 Feb 2024 08:28:01 -0800 (PST) X-Received: by 2002:a05:6512:2821:b0:511:80b2:ed55 with SMTP id cf33-20020a056512282100b0051180b2ed55mr4831623lfb.59.1707755281417; Mon, 12 Feb 2024 08:28:01 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW6NOXchB0acazCLbctM1UoRBCugQgjPPJhRRiC1g5Sbj6NKcFNuDaUj46wAre8TPuXrzks6w4FihqKW86lCAl+IMM7iAcXNSDuxwYOmBSFODdmdW43kAeymJ6feUUTBvGVxUsHWjQGEpkz5Vk/hFieQBKjzP0Js5DoYkopIRCOOf/HXlnfDpqumPB5S+NKyOENV18FmEdzBLDrWKca50cH4hWVoV9NXILE4UMZzqMBmaSs9hH/AST9Iixynm4tJeXHL71wGZLBNWkUuRJBEsQC74+noXFcEW1wJaQvp6gMkzaNKupU/Bn24Oj16MDggifZsJ68YKKeSvyS2bzMisj3SWgBBY7DbruPR0+48l2CIebzf9l9YjS8v/X31bZkOYgEzZv4YNyMFOHbnLMVUqSJTLDEIuWG0x5qCsyMrMUSsXZCTJbAe5hYjZUuqassyP6DRW8OCjoKJqiad/j/UMmIdjUs1xK845kB1phH9V+z49gEOHNlusnksQ7kYyK5cHDgAFWZeJWJMaY/UJYWN5t0RQMtbpaCOsxe7A/gFrGYVHsQaToqOS9VImv7ttR92359l2iiYwMvIh40PfBGu1cajiBrPDxPwZVcEMbUyHX9PsJDK3Rq1vYqFNYGH3aRArVEcuvLaJPu7M+2SUFTFLRfA5Dfsi+VXrbdIdR9xDyPsvmEyWZtdc18ca/J4lgiw3Te3fcKNGA5NIFGGpp/27plke07gcpWZXKUZGmK2gfc420fWKOqYbwDvAjLjefs8jZGjbvLj3nXQteA/DospYVTO2YhqTukcAmRlDSjdMK36BaL13avvU2+pzyuxb18o9/qMOAafoJrlsSYONRvgEPrlbqwahY0Q7rd0FH1UNRm Received: from ?IPV6:2003:cb:c730:2200:7229:83b1:524e:283a? (p200300cbc7302200722983b1524e283a.dip0.t-ipconnect.de. [2003:cb:c730:2200:7229:83b1:524e:283a]) by smtp.gmail.com with ESMTPSA id jj19-20020a05600c6a1300b0040fccf7e8easm9024482wmb.36.2024.02.12.08.27.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Feb 2024 08:28:00 -0800 (PST) Message-ID: Date: Mon, 12 Feb 2024 17:27:59 +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: [PATCH v5 22/25] mm: Add pte_batch_hint() to reduce scanning in folio_pte_batch() Content-Language: en-US To: Ryan Roberts , Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Mark Rutland , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240202080756.1453939-1-ryan.roberts@arm.com> <20240202080756.1453939-23-ryan.roberts@arm.com> <6d452a1a-1edc-4e97-8b39-99dc48315bb8@redhat.com> <82c59a7f-328e-4521-8855-ccacc3dc4ce5@arm.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bL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x/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <82c59a7f-328e-4521-8855-ccacc3dc4ce5@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12.02.24 16:47, Ryan Roberts wrote: > On 12/02/2024 13:43, David Hildenbrand wrote: >> On 02.02.24 09:07, Ryan Roberts wrote: >>> Some architectures (e.g. arm64) can tell from looking at a pte, if some >>> follow-on ptes also map contiguous physical memory with the same pgprot. >>> (for arm64, these are contpte mappings). >>> >>> Take advantage of this knowledge to optimize folio_pte_batch() so that >>> it can skip these ptes when scanning to create a batch. By default, if >>> an arch does not opt-in, folio_pte_batch() returns a compile-time 1, so >>> the changes are optimized out and the behaviour is as before. >>> >>> arm64 will opt-in to providing this hint in the next patch, which will >>> greatly reduce the cost of ptep_get() when scanning a range of contptes. >>> >>> Tested-by: John Hubbard >>> Signed-off-by: Ryan Roberts >>> --- >>>   include/linux/pgtable.h | 18 ++++++++++++++++++ >>>   mm/memory.c             | 20 +++++++++++++------- >>>   2 files changed, 31 insertions(+), 7 deletions(-) >>> >>> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h >>> index 50f32cccbd92..cba31f177d27 100644 >>> --- a/include/linux/pgtable.h >>> +++ b/include/linux/pgtable.h >>> @@ -212,6 +212,24 @@ static inline int pmd_dirty(pmd_t pmd) >>>   #define arch_flush_lazy_mmu_mode()    do {} while (0) >>>   #endif >>>   +#ifndef pte_batch_hint >>> +/** >>> + * pte_batch_hint - Number of pages that can be added to batch without scanning. >>> + * @ptep: Page table pointer for the entry. >>> + * @pte: Page table entry. >>> + * >>> + * Some architectures know that a set of contiguous ptes all map the same >>> + * contiguous memory with the same permissions. In this case, it can provide a >>> + * hint to aid pte batching without the core code needing to scan every pte. >> >> I think we might want to document here the expectation regarding >> dirty/accessed bits. folio_pte_batch() will ignore dirty bits only with >> FPB_IGNORE_DIRTY. But especially for arm64, it makes sense to ignore them >> always when batching, because the dirty bit may target any pte part of the >> cont-pte group either way. >> >> Maybe something like: >> >> " >> An architecture implementation may only ignore the PTE accessed and dirty bits. >> Further, it may only ignore the dirty bit if that bit is already not >> maintained with precision per PTE inside the hinted batch, and ptep_get() >> would already have to collect it from various PTEs. >> " > > I'm proposing to simplify this to: > > " > An architecture implementation may ignore the PTE accessed state. Further, the > dirty state must apply atomically to all the PTEs described by the hint. > " > > Which I think more accurately describes the requirement. Shout if you disagree. I'm not 100% sure if the "must apply atomically" is clear without all of the cont-pte details and ptep_get(). But I fail to describe it in a better way. It's all better compared to what we had before, so LGTM :) -- Cheers, David / dhildenb