Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2266924rdb; Fri, 8 Dec 2023 03:24:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGr9HIHxL0/tog3H3wnqz//1UKoLu8JuSk7g/rWQ8s3qmF6HR7nMOdZJS49YKg0IIzjncPv X-Received: by 2002:a05:6358:7e8c:b0:170:17eb:2fa9 with SMTP id o12-20020a0563587e8c00b0017017eb2fa9mr2725571rwn.34.1702034674455; Fri, 08 Dec 2023 03:24:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702034674; cv=none; d=google.com; s=arc-20160816; b=mhq/hApB1zBnjyxewtwyDXqU1Oh9Lj/bgDpcyPyWD7ZDXQ/oQSZSDQKnuNb7V+l1wd N/qy1BOMnMVwq75PXRztJavWsSCF4pwBf1VBZSRMEYGwTmsZcTpVVwMO+PX1GBA155kz V8CfJZ4qVj2AjwSFi7OdG4l6ayxTtPwImkXxs8WwA7iFEL1bWZH4a3JvOTsh9tLlSzbn gDk//bLUscr8EGvlQd0yiS+arThR1ScsdHxH5akKDmIP49Cg7B0D0Pr6QXnCNvANFUeW BBjTREu9sz6hNrw8TX9KSlBg9vbkQV5jCBQj8feUOfzu6pFUNwbPjLqyPXLxsbfoBYpu dzhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:autocrypt:from:references:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature; bh=RCuVfiFWHDbXLNBhRFvIja18LVxlp+/90vRsS/RVFDc=; fh=hQEHPXnaUsl1auX/pulhVwj/SGzjJj/1zjShz0vMdWM=; b=j1UMhMNR0MtzNJDk9Re5KMJ2gQif/fQRaKzcJTqJzn9V00LDqZng1fka99PfOelj4J dtMiD2E9geyBB0sAvtI6PkYpfkOlBed+UmNDh54FpochMUFdEDYJ+jq4v408LdkuEZJ4 hJaCPpr/to0bZBOGcwx63wE3UJTNWHF9bkuT2m1dcXcsi0yRQh6vAE3GuDu7BJEvCT2J EtfBl1DR2QCn+re5yheo7pPKMB6RCHJ6vf601jC6414AAjd47JykMpq/iE1cIQDDUaQI GXf16KVv9X8sS/cDZzmL1d95T4eY+KImTMNCb0NsP+L3da/7z13RoQ77XOlmZjdPAtbN RLpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ou8kQfLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id v12-20020a65568c000000b0057942bfab4dsi1334555pgs.395.2023.12.08.03.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 03:24:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ou8kQfLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B212A829AA1A; Fri, 8 Dec 2023 03:24:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232163AbjLHLYN (ORCPT + 99 others); Fri, 8 Dec 2023 06:24:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbjLHLYL (ORCPT ); Fri, 8 Dec 2023 06:24:11 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670EF10CA for ; Fri, 8 Dec 2023 03:24:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702034656; 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=RCuVfiFWHDbXLNBhRFvIja18LVxlp+/90vRsS/RVFDc=; b=Ou8kQfLKMr/v3xDfzZ0iZf4axcr21Fwhb2EmAUnVk3tdLiMvk4ZK6dO15H1ezauD7/z/Um 6DLfmtzm3kgNP2ERe+ISXIBlNG7yqH+iig80INqUgiutFz8f2+bHVRRUCAQ3AO++VdAfJn r3tq2fH+juWDbZ7VfxZo18tpID7u4LQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-nCGHvd_MOzKhTNqMIinvjQ-1; Fri, 08 Dec 2023 06:24:15 -0500 X-MC-Unique: nCGHvd_MOzKhTNqMIinvjQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-40b39377136so14054305e9.1 for ; Fri, 08 Dec 2023 03:24:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702034654; x=1702639454; 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=RCuVfiFWHDbXLNBhRFvIja18LVxlp+/90vRsS/RVFDc=; b=mYSEBYIx9GQqYxRn93DbRyuZ3pWQ27Q6n2p/kye0LeWNTarXDOxE4Mg888+1w0JECO zCbr9vuoDkiqH1Bpx7Zm6IbwDLcHw3aoB0sFYggWO7vvq31vSRLHlpbq3y52Lpx0fBYS mt8ghkn4nHzypLI16iPlRxY8KR8LXfW86hF+Mng5iJk4A9G+6gw6mO0POQR+4UvwPpV+ AzOWBKmt7o0GJ8qydgxf2ds8VOZiFnlfUtbICENovzLDtlCtvDlmkkcF++HE+gAwL/Jk zwf6udwbMrcQgJEzMwu3fgJpPpps74cvCZcvCvjRGH7CwDAFyFSG1zgotk76AIFT4W2U y+Kg== X-Gm-Message-State: AOJu0YxdzDtrlbOHGJQQwgFtEngbKC8Urw8/ZwpR525N11PTW3rCJ5lk JifCT8GgA+vTyVo5P7eGs8eNR9Hmf0i6gEQIwl6EBdzDMCxUfOFzMADttz60yGsukDezv9NyW6y rTG/0wnYul0rWkw8NRVTlu6U+Zz0pJLi0 X-Received: by 2002:a05:600c:354f:b0:401:bd2e:49fc with SMTP id i15-20020a05600c354f00b00401bd2e49fcmr2276363wmq.24.1702034654028; Fri, 08 Dec 2023 03:24:14 -0800 (PST) X-Received: by 2002:a05:600c:354f:b0:401:bd2e:49fc with SMTP id i15-20020a05600c354f00b00401bd2e49fcmr2276347wmq.24.1702034653621; Fri, 08 Dec 2023 03:24:13 -0800 (PST) Received: from ?IPV6:2003:cb:c724:2100:3826:4f41:d72c:dc1b? (p200300cbc724210038264f41d72cdc1b.dip0.t-ipconnect.de. [2003:cb:c724:2100:3826:4f41:d72c:dc1b]) by smtp.gmail.com with ESMTPSA id i6-20020a5d55c6000000b0033340aa3de2sm1822647wrw.14.2023.12.08.03.24.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Dec 2023 03:24:13 -0800 (PST) Message-ID: Date: Fri, 8 Dec 2023 12:24:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 00/39] mm/rmap: interface overhaul Content-Language: en-US To: Ryan Roberts , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Andrew Morton , "Matthew Wilcox (Oracle)" , Hugh Dickins , Yin Fengwei , Mike Kravetz , Muchun Song , Peter Xu , "Yin, Fengwei" References: <20231204142146.91437-1-david@redhat.com> <993ea322-8cdb-4ab1-84d3-0a1cb40049c9@arm.com> <067753e4-faf0-4bc0-9703-ec97b7de705e@redhat.com> <1ba5dd86-a201-4243-bab0-349395468236@arm.com> <537ac106-e4f6-4845-aa09-29b775269562@redhat.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//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7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S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 08 Dec 2023 03:24:30 -0800 (PST) On 05.12.23 14:49, Ryan Roberts wrote: > On 05/12/2023 13:39, David Hildenbrand wrote: >> On 05.12.23 14:31, Ryan Roberts wrote: >>> On 05/12/2023 09:56, David Hildenbrand wrote: >>>>>> >>>>>> Ryan has series where we would make use of folio_remove_rmap_ptes() [1] >>>>>> -- he carries his own batching variant right now -- and >>>>>> folio_try_dup_anon_rmap_ptes()/folio_dup_file_rmap_ptes() [2]. >>>>> >>>>> Note that the contpte series at [2] has a new patch in v3 (patch 2), which >>>>> could >>>>> benefit from folio_remove_rmap_ptes() or equivalent. My plan was to revive [1] >>>>> on top of [2] once it is merged. >>>>> >>>>>> >>>>>> There is some overlap with both series (and some other work, like >>>>>> multi-size THP [3]), so that will need some coordination, and likely a >>>>>> stepwise inclusion. >>>>> >>>>> Selfishly, I'd really like to get my stuff merged as soon as there is no >>>>> technical reason not to. I'd prefer not to add this as a dependency if we can >>>>> help it. >>>> >>>> It's easy to rework either series on top of each other. The mTHP series has >>>> highest priority, >>>> no question, that will go in first. >>> >>> Music to my ears! It would be great to either get a reviewed-by or feedback on >>> why not, for the key 2 patches in that series (3 & 4) and also your opinion on >>> whether we need to wait for compaction to land (see cover letter). It would be >>> great to get this into linux-next ASAP IMHO. >> >> On it :) >> >>> >>>> >>>> Regarding the contpte, I think it needs more work. Especially, as raised, to not >>>> degrade >>>> order-0 performance. Maybe we won't make the next merge window (and you already >>>> predicated >>>> that in some cover letter :P ). Let's see. >>> >>> Yeah that's ok. I'll do the work to fix the order-0 perf. And also do the same >>> for patch 2 in that series - would also be really helpful if you had a chance to >>> look at patch 2 - its new for v3. >> >> I only skimmed over it, but it seems to go into the direction we'll need. >> Keeping order-0 performance unharmed should have highest priority. Hopefully my >> microbenchmarks are helpful. > > Yes absolutely - are you able to share them?? > >> >>> >>>> >>>> But again, the conflicts are all trivial, so I'll happily rebase on top of >>>> whatever is >>>> in mm-unstable. Or move the relevant rework to the front so you can just carry >>>> them/base on them. (the batched variants for dup do make the contpte code much >>>> easier) >>> >>> So perhaps we should aim for mTHP, then this, then contpte last, benefiting from >>> the batching. >> >> Yeah. And again, I don't care too much if I have to rebase on top of your work >> if this here takes longer. It's all a fairly trivial conversion. >> >>>> >>>> [...] >>>> >>>>>> >>>>>> >>>>>> New (extended) hugetlb interface that operate on entire folio: >>>>>>    * hugetlb_add_new_anon_rmap() -> Already existed >>>>>>    * hugetlb_add_anon_rmap() -> Already existed >>>>>>    * hugetlb_try_dup_anon_rmap() >>>>>>    * hugetlb_try_share_anon_rmap() >>>>>>    * hugetlb_add_file_rmap() >>>>>>    * hugetlb_remove_rmap() >>>>>> >>>>>> New "ordinary" interface for small folios / THP:: >>>>>>    * folio_add_new_anon_rmap() -> Already existed >>>>>>    * folio_add_anon_rmap_[pte|ptes|pmd]() >>>>>>    * folio_try_dup_anon_rmap_[pte|ptes|pmd]() >>>>>>    * folio_try_share_anon_rmap_[pte|pmd]() >>>>>>    * folio_add_file_rmap_[pte|ptes|pmd]() >>>>>>    * folio_dup_file_rmap_[pte|ptes|pmd]() >>>>>>    * folio_remove_rmap_[pte|ptes|pmd]() >>>>> >>>>> I'm not sure if there are official guidelines, but personally if we are >>>>> reworking the API, I'd take the opportunity to move "rmap" to the front of the >>>>> name, rather than having it burried in the middle as it is for some of these: >>>>> >>>>> rmap_hugetlb_*() >>>>> >>>>> rmap_folio_*() >>>> >>>> No strong opinion. But we might want slightly different names then. For example, >>>> it's "bio_add_folio" and not "bio_folio_add": >>>> >>>> >>>> rmap_add_new_anon_hugetlb() >>>> rmap_add_anon_hugetlb() >>>> ... >>>> rmap_remove_hugetlb() >>>> >>>> >>>> rmap_add_new_anon_folio() >>>> rmap_add_anon_folio_[pte|ptes|pmd]() >>>> ... >>>> rmap_dup_file_folio_[pte|ptes|pmd]() >>>> rmap_remove_folio_[pte|ptes|pmd]() >>>> >>>> Thoughts? >>> >>> Having now reviewed your series, I have a less strong opinion, perhaps it's >>> actually best with your original names; "folio" is actually the subject after >>> all; it's the thing being operated on. So far I sticked to the original names used in this RFC. I'm testing a new series that is based on current mm/unstable (especially, mTHP) and contains all changes discussed here. If I don't here anything else, I'll send that out as v1 on Monday. Thanks! -- Cheers, David / dhildenb