Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp588168rdg; Thu, 10 Aug 2023 12:23:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwsseDPXiQMkp9f2JMbs4HX7/3pDK4c6tsiw//rpQAbGK+0teowxDVCGlUDyjdoeFWGCUS X-Received: by 2002:a05:6a00:a11:b0:687:40d8:8869 with SMTP id p17-20020a056a000a1100b0068740d88869mr4977476pfh.8.1691695392664; Thu, 10 Aug 2023 12:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691695392; cv=none; d=google.com; s=arc-20160816; b=U4aTHw/evmLcKUWsVFAUqh7oGMwjQvv4iioxTNQKRAvm846w6y1w9DtB8XXRDrHy7q mPakp0dXZqyqRDlmD9l727aKa9dorBYpLa2T1GFGytXRMfW9svE8qhuUS+uw1haTMhNq kJyLwFGY1RHS6oJWjWlBqNm//En6Vba+LMkj8Wh+LMYM6oaBHhxVuFYapdkpRkc6mKCm WpUHfg7rTHCEoi664eKiLO1HDGCeM12GDWksUmxvpn/QP1xbPFC3iUGj8xPGAsNMKS+u nl+Hz3fPkl9/TPQI0wJ6f3ZHPa7ZTxIbZptevKTbShCw+8QAxdZWYEw/p/lgqqkdvBtf 5bBA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Iq9xatht8bNqRDHtDODXQKgF7aRWEuTRd1QCXb+gRF4=; fh=HMbQfyAvLe7iIsSAAqFZcI6a5rrnZvFXFdrSuBprNfk=; b=izblYbH8ApVlxjYjN5asonh+am+mb/9UITwb4YEzpZQweuyy5xPolhOvfv4VKnUW6v twcFshK2fgYy/or9GbAOSCrkurqwdlXcdTyQbBxN5zrq9NZyRDjV1q0LwGoWnM8LMj1x BLBxF0yYA5BihAhK/zKQArCWpXuDCJTpuqsoLiNMQkwjE0bVwsPYXVLP7wgVH4HVVfRH 0jswH/Q/Twr9HDpe/dHRFrazKEwId6gxEcA58Vs1iLnuK0ftb0QA6H+9NQfdz4gvPUGB Hpyuxbff74AXg7PYBRDfHWV+hdmBvRMARRZEhb0ZGeZMxBDpYZ16EZYEaSAiYmUUNAKW NC/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay2-20020a056a00300200b00677a07fe4afsi1994649pfb.49.2023.08.10.12.23.00; Thu, 10 Aug 2023 12:23:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236244AbjHJTDD (ORCPT + 99 others); Thu, 10 Aug 2023 15:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234097AbjHJTDC (ORCPT ); Thu, 10 Aug 2023 15:03:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F133E26A0; Thu, 10 Aug 2023 12:03:01 -0700 (PDT) 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 2A228D75; Thu, 10 Aug 2023 12:03:44 -0700 (PDT) Received: from [192.168.0.23] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1517F3F6C4; Thu, 10 Aug 2023 12:02:59 -0700 (PDT) Message-ID: <1b68f3fd-54d8-4bcd-a986-c84ec2219b9c@arm.com> Date: Thu, 10 Aug 2023 20:02:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH mm-unstable v1] mm: add a total mapcount for large folios Content-Language: en-GB To: David Hildenbrand , Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, Andrew Morton , Jonathan Corbet , Mike Kravetz , Hugh Dickins , "Matthew Wilcox (Oracle)" , Yin Fengwei , Yang Shi , Zi Yan References: <20230809083256.699513-1-david@redhat.com> <155bd03e-b75c-4d2d-a89d-a12271ada71b@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/08/2023 18:47, David Hildenbrand wrote: > On 10.08.23 19:15, Peter Xu wrote: >> On Thu, Aug 10, 2023 at 11:48:27AM +0100, Ryan Roberts wrote: >>>> For PTE-mapped THP, it might be a bit bigger noise, although I doubt it is >>>> really significant (judging from my experience on managing PageAnonExclusive >>>> using set_bit/test_bit/clear_bit when (un)mapping anon pages). >>>> >>>> As folio_add_file_rmap_range() indicates, for PTE-mapped THPs we should be >>>> batching where possible (and Ryan is working on some more rmap batching). >>> >>> Yes, I've just posted [1] which batches the rmap removal. That would allow you >>> to convert the per-page atomic_dec() into a (usually) single per-large-folio >>> atomic_sub(). >>> >>> [1] >>> https://lore.kernel.org/linux-mm/20230810103332.3062143-1-ryan.roberts@arm.com/ >> >> Right, that'll definitely make more sense, thanks for the link; I'd be very >> happy to read more later (finally I got some free time recently..).  But >> then does it mean David's patch can be attached at the end instead of >> proposed separately and early? > > Not in my opinion. Batching rmap makes sense even without this change, and this > change makes sense even without batching. FWIW, I agree that my series and David's series should be treated independently. There is independent value in both. It's also worth pointing out that with my series, the amount of batching you see in practice still depends on large folios being mapped, which isn't quite the common case yet.