Message ID | 20230609120347.63936-1-zhangpeng.00@bytedance.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp898389vqr; Fri, 9 Jun 2023 05:11:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zUOIz2WW8PtTDSxEmNkRnNnJ/uasHGpDHcao81Oc+mCKz4RYMFxk1/aipbyBgCmoAXoNo X-Received: by 2002:a05:6a21:339c:b0:f0:50c4:4c43 with SMTP id yy28-20020a056a21339c00b000f050c44c43mr2047037pzb.5.1686312689105; Fri, 09 Jun 2023 05:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686312689; cv=none; d=google.com; s=arc-20160816; b=sn8zU1EYdA+H+BnW780C/xRumqYz/+Lm3xOw392/sfNI0V2DXgotydjiIe76vB9UdC UmDuyNZ6SMsZ5eiJqbbZSB8Q78OSdNCnuqoI/V6RgIOaVL4n18v5i6KVJo50CRxC3mm4 5eiVjH/99n6EI3QXZA255kYKymAWoaBHFxz8ObmtTpqE03llpRVB0UKZeo0l3K9BP5JD 2+5AMvyxjeKMggPdR+h0Vu6avT78DvR5efOJ0xUoQW2luRR1Fphm17M6On6EcXfVeJc4 J+0o74cwy3DUj4TzYwaCeQkDBFHGJbrfFh4OGO/afVXULczEzDmWR1Oe1vJPXBZwu7ii 4kcw== 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:dkim-signature; bh=lp6OV13Bt/hNYfWu+dUWpmpBFuOi+D6XcFIiA8tjOKg=; b=iIyMI5quKH2eZScM28Ybuv8ERC0yAKUwHye1ZFQnQt4M4lGayQdF1btwFemR+trIUH zkbeGelqkMx7E8VtP/e7TB0PdJuXg0h5mWknLwQLys512juV0IHI0E9hcyum9jB2vIfs +Wb+tVWCF3eyHk8ulX5ohY1wnEGnqxHjdLWybV/spBUdJpXOQiz6WYBgUDcVEhRd8qrW rtHFnJlFrMzOpyIBYszwdFJRV/kQOztKKycXcMFO7ombc2NfQ9+seECt0KLGDEG4FvVy K6HT5cWg+Y3H7p2D6LnEe6aRjmJ78s/+KyuLuwte+kj7v33yQhyLhDlA6twfRu8iMd7S JIcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=PRc3ZLG9; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j68-20020a636e47000000b00542da138a68si2612572pgc.226.2023.06.09.05.11.13; Fri, 09 Jun 2023 05:11:29 -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; dkim=pass header.i=@bytedance.com header.s=google header.b=PRc3ZLG9; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239859AbjFIMFQ (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Fri, 9 Jun 2023 08:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240217AbjFIME6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 9 Jun 2023 08:04:58 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F5D730FB for <linux-kernel@vger.kernel.org>; Fri, 9 Jun 2023 05:04:32 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-662f0feafb2so1317702b3a.1 for <linux-kernel@vger.kernel.org>; Fri, 09 Jun 2023 05:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1686312272; x=1688904272; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=lp6OV13Bt/hNYfWu+dUWpmpBFuOi+D6XcFIiA8tjOKg=; b=PRc3ZLG9xumYTe3iNTpYxXmSIfnSJd3hDh7S5Kbt9/Im5mvIeUsyviNVibu6klxK4i A2qhQgXsIsD4vx5O6T/e9xkVtT6XySDs3rp6HVIU+P2iyuE/6ugFVGT+GJQTll5OkUnD nrc65hI+bajJDfpIq0Yfm8XovTN0AiqZnU7deGI0gtJ8C8lqDPzdxBx47MVXwRmtj1OF T3g2sr5SU8kShraGEVEpWfve2NHe5Q/eje488uWjHo2du6l4xBVDNYChX2pON9axAJd8 i96aK6DqlBqd7CvDHL8aMoabvlhd5FYQDMh6jDiaTfH9EPUe9ZzmC0CXSqgV1hYezvPc JXQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686312272; x=1688904272; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lp6OV13Bt/hNYfWu+dUWpmpBFuOi+D6XcFIiA8tjOKg=; b=ZVbHZkMA5pOovsXD6M1BEGS6d23iK+bQWXJzrVeFFrzQZvCtkRXJCf1j5WzBKZ0nq1 9gKxvptu0JDo+YnZRPjSOc7Wq+ucjLJhUcYlYQZv3AXYfBvy965yilpGfAgqCZ4q15Bd P3q9zFj/040JN1jyyhXFXR8AtRpNvUhk/EtRWbq7AyaMnq7PCSGrlwfo4bC/mRT5O3bc qOLmWTO7HljwUEjvC43c2YkHjDVArz8jBKEa+JTQQU8YOlEG/cHM/i9I59wsiUN50w4T pm0BlbaKJ/1m0YtNMOvC7RgRbSY2lpd2nrJf6BT6lTGp+Hj+GMD3WcB+2GPxg9Vzol/q OCrw== X-Gm-Message-State: AC+VfDxUKPA7351v3Zo9hXZsyXwHZblhlWJ9IWN5F2c4Naf7tVeuhAm3 6X7mdcwhSQPhTHarxo+o2JmnSQ== X-Received: by 2002:a05:6a20:3947:b0:10c:2c30:4765 with SMTP id r7-20020a056a20394700b0010c2c304765mr2091168pzg.1.1686312271708; Fri, 09 Jun 2023 05:04:31 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.249]) by smtp.gmail.com with ESMTPSA id v12-20020a65568c000000b00514256c05c2sm2619168pgs.7.2023.06.09.05.04.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 09 Jun 2023 05:04:31 -0700 (PDT) From: Peng Zhang <zhangpeng.00@bytedance.com> To: Liam.Howlett@oracle.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Peng Zhang <zhangpeng.00@bytedance.com> Subject: [PATCH v2 0/3] Optimize the fast path of mas_store() Date: Fri, 9 Jun 2023 20:03:44 +0800 Message-Id: <20230609120347.63936-1-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768227014105018567?= X-GMAIL-MSGID: =?utf-8?q?1768227014105018567?= |
Series | Optimize the fast path of mas_store() | |
Message
Peng Zhang
June 9, 2023, 12:03 p.m. UTC
Add fast paths for mas_wr_append() and mas_wr_slot_store() respectively. The newly added fast path of mas_wr_append() is used in fork() and how much it benefits fork() depends on how many VMAs are duplicated. Changes since v1: - Revise comment and commit log. [3/3] - Add test for mas_wr_modify() fast path. [1/3] v1: https://lore.kernel.org/lkml/20230602075353.5917-1-zhangpeng.00@bytedance.com/ Peng Zhang (3): maple_tree: add test for mas_wr_modify() fast path maple_tree: optimize mas_wr_append(), also improve duplicating VMAs maple_tree: add a fast path case in mas_wr_slot_store() lib/maple_tree.c | 69 ++++++++++++++++++++++++++++--------------- lib/test_maple_tree.c | 65 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 23 deletions(-)
Comments
* Peng Zhang <zhangpeng.00@bytedance.com> [230609 08:04]: > Add fast paths for mas_wr_append() and mas_wr_slot_store() respectively. > The newly added fast path of mas_wr_append() is used in fork() and how > much it benefits fork() depends on how many VMAs are duplicated. > > Changes since v1: > - Revise comment and commit log. [3/3] > - Add test for mas_wr_modify() fast path. [1/3] Thanks for adding the tests. I'm just trying to figure out how to best address testing this in RCU mode. And by testing it I mean add tests in RCU that does this and detect the failure by modifying your code, then change it back and have it pass the test by falling back to node store. This would need to change tools/testing/radix-tree/maple.c to update the testing there. > > v1: https://lore.kernel.org/lkml/20230602075353.5917-1-zhangpeng.00@bytedance.com/ > > Peng Zhang (3): > maple_tree: add test for mas_wr_modify() fast path > maple_tree: optimize mas_wr_append(), also improve duplicating VMAs > maple_tree: add a fast path case in mas_wr_slot_store() > > lib/maple_tree.c | 69 ++++++++++++++++++++++++++++--------------- > lib/test_maple_tree.c | 65 ++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 111 insertions(+), 23 deletions(-) > > -- > 2.20.1 >
在 2023/6/14 01:23, Liam R. Howlett 写道: > * Peng Zhang <zhangpeng.00@bytedance.com> [230609 08:04]: >> Add fast paths for mas_wr_append() and mas_wr_slot_store() respectively. >> The newly added fast path of mas_wr_append() is used in fork() and how >> much it benefits fork() depends on how many VMAs are duplicated. >> >> Changes since v1: >> - Revise comment and commit log. [3/3] >> - Add test for mas_wr_modify() fast path. [1/3] > > Thanks for adding the tests. I'm just trying to figure out how to best > address testing this in RCU mode. And by testing it I mean add tests in > RCU that does this and detect the failure by modifying your code, then > change it back and have it pass the test by falling back to node store. > This would need to change tools/testing/radix-tree/maple.c to update the > testing there. I see what you mean now, I will try to make a test in RCU mode. > >> >> v1: https://lore.kernel.org/lkml/20230602075353.5917-1-zhangpeng.00@bytedance.com/ >> >> Peng Zhang (3): >> maple_tree: add test for mas_wr_modify() fast path >> maple_tree: optimize mas_wr_append(), also improve duplicating VMAs >> maple_tree: add a fast path case in mas_wr_slot_store() >> >> lib/maple_tree.c | 69 ++++++++++++++++++++++++++++--------------- >> lib/test_maple_tree.c | 65 ++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 111 insertions(+), 23 deletions(-) >> >> -- >> 2.20.1 >> >