Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5660501rwp; Mon, 17 Jul 2023 07:39:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlHlISNpyTu+LVeZjnBT7HKFs4tBHEcTm1L2tgaZIIMAO8RYd4boKDMKfYkx7KZBwWp/ShJ9 X-Received: by 2002:a17:907:985b:b0:982:cfe2:32fe with SMTP id jj27-20020a170907985b00b00982cfe232femr11832065ejc.63.1689604761857; Mon, 17 Jul 2023 07:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689604761; cv=none; d=google.com; s=arc-20160816; b=zmu6eTcbAlatVImMIV5XPTkM2QY+B8OMskPmE/y4fePMEmgOUkIPucx5NjnC0Y1FWo rfgdNdF9NnEqjsOhcyFqcmaYky9x6n5cSClUI4nqgzIftpwnoa6FG7nSZ1fywmF1hhWp EtR/UMkan/RdYh/bCEiC31PMTj1o4i3UC4qtOR/7l4dvQOy94GgsfLW4HUMNEgOMw59k DUesNx7kBuXSzLzYlnjhtrU0suD8CvZV++HAxN3Lq5R/A8OeoaU3n9PMDimdCIRwHU37 xWXOwwE0rNIXOnrqHxfoG1adsKxhMyPtMIeE/cwLOhiewm1KEhQLKfSlDxg+TDU8JXFV kmSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=k4unwWaXzQxSqzFf67N7y41Ql9mmqFKqQZGSlaMXiT4=; fh=THi7eKCjaWcVibUnyL3CTjC3PwRMYqk9JChFkSe1vn0=; b=REiDQgRW7a699/d3l8gS4+YqBssqyOTqi6m+G7GWYinkv5cgCGFhJv/0OIafQt3iTP F0OTuVLvxHb3cOUf6OVr/RokArd1FzzPCroKejb1x9H4NgF0LfpTe5X43oHFtouadShT NJB8YAyJFKt0I1czgeXjAGXd0KC1nKPPBYxbul/sjxgtN3o5g4/SP13FS4I0f7zaJC8N DOa0C+7OYIgZXEYC0/7Gc12rDeQddhh4Onj/xBuXBPDB9xVaxaiS0YxSeGuMf2NlbY66 Tq8KeMv6FNbUJ4olZj0L0JU2SyAZdcqf+r1LqQpQdexM/5vesDcRHaDAwuH13cptQgQh btEQ== 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 w11-20020a1709064a0b00b00992e14a0107si13906052eju.246.2023.07.17.07.38.57; Mon, 17 Jul 2023 07:39:21 -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 S231303AbjGQObZ (ORCPT + 99 others); Mon, 17 Jul 2023 10:31:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230527AbjGQObX (ORCPT ); Mon, 17 Jul 2023 10:31:23 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4E4A4C0 for ; Mon, 17 Jul 2023 07:31:22 -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 B82DAC15; Mon, 17 Jul 2023 07:32:04 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C6EF53F738; Mon, 17 Jul 2023 07:31:19 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Yang Shi , "Huang, Ying" , Zi Yan Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 0/3] Optimize large folio interaction with deferred split Date: Mon, 17 Jul 2023 15:31:07 +0100 Message-Id: <20230717143110.260162-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Hi All, This is a small series in support of my work to enable the use of large folios for anonymous memory (currently called "FLEXIBLE_THP") [1]. It first makes it possible to add large, non-pmd-mappable folios to the deferred split queue. Then it modifies zap_pte_range() to batch-remove spans of physically contiguous pages from the rmap, which means that in the common case, we elide the need to ever put the folio on the deferred split queue, thus reducing lock contention and improving performance. This becomes more visible once we have lots of large anonymous folios in the system, and Huang Ying has suggested solving this needs to be a prerequisit for merging the main FLEXIBLE_THP work. The series applies on top of v6.5-rc2 and a branch is available at [2]. I don't have a full test run with the latest versions of all the patches on top of the latest baseline, so not posting results formally. I can get these if people feel they are neccessary though. But anecdotally, for the kernel compilation workload, this series reduces kernel time by ~4% and reduces real-time by ~0.4%, compared with [1]. [1] https://lore.kernel.org/linux-mm/20230714160407.4142030-1-ryan.roberts@arm.com/ [2] https://gitlab.arm.com/linux-arm/linux-rr/-/tree/features/granule_perf/deferredsplit-lkml_v1 Thanks, Ryan Ryan Roberts (3): mm: Allow deferred splitting of arbitrary large anon folios mm: Implement folio_remove_rmap_range() mm: Batch-zap large anonymous folio PTE mappings include/linux/rmap.h | 2 + mm/memory.c | 119 +++++++++++++++++++++++++++++++++++++++++++ mm/rmap.c | 67 +++++++++++++++++++++++- 3 files changed, 187 insertions(+), 1 deletion(-) -- 2.25.1