From patchwork Mon Jul 17 14:31:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 12143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1155709vqt; Mon, 17 Jul 2023 07:44:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJxXRIJ2ZliuvtqoK/I8ibuRpnwwQ3GvNJL2WW8B4eoQcghcdBW+rx+r4sJdbFbHQXsf+T X-Received: by 2002:a17:906:1114:b0:98e:4c96:6e1f with SMTP id h20-20020a170906111400b0098e4c966e1fmr11922443eja.69.1689605076791; Mon, 17 Jul 2023 07:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689605076; cv=none; d=google.com; s=arc-20160816; b=QN73V7+3RygIOwXo0u8PLL4/Ysi746gkfcAc5gFBr1QC17EKk2G39zTeRzFqJJPamC 6qhUQkmqEyHd13Dt4slRVIW7Ht09rUJ2pm82geArpld9COyw0fFwFT0SQb/ciyEo5XCK FuOQeItb+IsdCNyFQKJj/Xfdn7MhlkVtlPufC8IXHZyMHi2jHUh7GyeD0SwIVnh8AykJ 6mQT553DMz5kEhvkw/+DPoatdYApD3RN/XMNF39lHMOW5ra0P5I4u4dufrkL7ufru0Vd D/6DPtu9ooJF3K05lZwextyZwZvLfwF0qxKCTU65HhVYKCB2nzf996qNq3ROeCMSb3xp cJ3Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a170906080700b00992f309cfe9si4249623ejd.598.2023.07.17.07.44.11; Mon, 17 Jul 2023 07:44:36 -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 S231310AbjGQObZ (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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771679332963257596 X-GMAIL-MSGID: 1771679332963257596 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