From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4C12D60D1B for ; Tue, 19 Nov 2024 09:59:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BF2D6B0096; Tue, 19 Nov 2024 04:59:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 36F536B0098; Tue, 19 Nov 2024 04:59:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 238EB6B0099; Tue, 19 Nov 2024 04:59:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F3A9B6B0096 for ; Tue, 19 Nov 2024 04:59:56 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9B04914034D for ; Tue, 19 Nov 2024 09:59:56 +0000 (UTC) X-FDA: 82802397888.28.C5BDB7C Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by imf07.hostedemail.com (Postfix) with ESMTP id 59C734001F for ; Tue, 19 Nov 2024 09:58:44 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hXlbqkY1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732010260; a=rsa-sha256; cv=none; b=5PnNzKwz1COq0nwC84G1mTjfj99dBMGtjZAjM8CplTkfpx3WEZwGBJjYe6gfOsmYAXfYyF 5J3lB0ez1z0mwPBFNHTRKy3NQ8AcM1JxlT953K7W0kTGOjpfAmYQnf5NateQGol4GhhTuu +LQNm86FwnAATeENP1x3c03MfI1/iHc= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hXlbqkY1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732010260; h=from:from:sender:reply-to: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:dkim-signature; bh=p1ehDDtmRPifXFMXVHEIhBayF0MkyvbkdJUxO04BnyE=; b=KX29yCHu3Bf39gOVVjFrG4qDv1cH7dTtEM4nTm5FIKwWsorfHraf1OYMkSR0z35+Lgf3u8 ZD+MLOOil6CJcatMYBYC17D9MO6cji47YS/Q5FPgK+qyn7xEVttwVhDaey3WKLobFbrm/d 05imMBGtAQvX5QNLY5Wz3kbnYeRMME4= Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5cfa9979cd1so5251694a12.1 for ; Tue, 19 Nov 2024 01:59:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732010393; x=1732615193; darn=kvack.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=p1ehDDtmRPifXFMXVHEIhBayF0MkyvbkdJUxO04BnyE=; b=hXlbqkY1EQOH+wxBDvZIumH15FWIVxnbv56fgh0Ep3g0+vwxBzzFiQxCcww3AXmffl Z1e6dKH4P9BhwgTBmcqriHcuWirTRmoAoe2TQ3khwk9XDawi8pNNx8ExL4r5YSzWbmWi /subuQN6WHt4TNpfdTD835RN+70NObkzIFSh+pgIGZhJOwo7qJa07Q7KTaTu5izGYZKu eIN/zrkJH1/zveb7jIFb+FmRxyPjrMVrGAV4L31q0UaX9Y1FwR02u2Pkb4NPiVHnvTsG aYzqazoe1eFdiHCcWNyiH3EeP9I1L1GdRVgdIDSjctvoMsrK/U4bxaxvnmoEL5chURLS iGsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732010393; x=1732615193; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=p1ehDDtmRPifXFMXVHEIhBayF0MkyvbkdJUxO04BnyE=; b=ABJddalMzp0haMpFo7gPqXWGfv1YBK4KfNGYE9HuxtfBzAVZfLL1JRdTgp28hHQwYp 3EALDq2BKetpkZNpUuiT3LgGR52OmGvZBmppUZvw4ZobetLnQhGAhj6RJ+UNBV5FMulR Yue3GzHPj+IPjGvcKg1z8r2fAYBkcl/2e1XNBvEiVwW7C4izXyOYNL37MKF8I7L38s+r xDE4kGYlWonUw7vlGsA9u/GR+Fu13PjSVTu0SUIvfvx/oXQooq1TjOiHaaGfmJI605TF 3F/tjN7DsapV+/hYCVv6Up3WxWyTivkyAbz86hG7m5uYdeHniVdXjjmThX6jdFxIyb4F KSrA== X-Forwarded-Encrypted: i=1; AJvYcCXJr29MvodErTm0dgSnaKdeqxXxHV9nf9Vt/PDANUjZ9IEwtckUu/zll98MOr9evwyXL/x6L8p1lA==@kvack.org X-Gm-Message-State: AOJu0YxugA9SZQkm6ZbMNuKcZw5LRX2ATkPzYA1Fy+ogG5jrbXMqZ/Ig axkXT9RAq7KPo5HIqqVVJ220zPTNwwfupqiOngdsnC+pqcwvGoU0jR5wvw== X-Google-Smtp-Source: AGHT+IHOHyHO2oAmtv5u9jyQfez3CaQnsfH3At+m9BeIVTRpwUyC89t4VFBEVcNJtXns3mXdL0K7YQ== X-Received: by 2002:a05:6402:358a:b0:5cf:cec3:d53 with SMTP id 4fb4d7f45d1cf-5cfde5be357mr2668276a12.3.1732010392859; Tue, 19 Nov 2024 01:59:52 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cfc0f4d7f7sm2154474a12.13.2024.11.19.01.59.52 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Nov 2024 01:59:52 -0800 (PST) Date: Tue, 19 Nov 2024 09:59:51 +0000 From: Wei Yang To: Sid Kumar Cc: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, linux-mm@kvack.org, akpm@linux-foundation.org, liam.howlett@oracle.com Subject: Re: [PATCH 0/5] Track node vacancy to reduce worst case allocation counts Message-ID: <20241119095951.a46jgpbkz7suaahk@master> Reply-To: Wei Yang References: <20241114170524.64391-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Rspamd-Queue-Id: 59C734001F X-Stat-Signature: ysyqnyxhosssoezb8fi4191zm3dpbgwa X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1732010324-39760 X-HE-Meta: U2FsdGVkX1+nkof1WDR/Yp9vH957Jbs1ARu4/ntIhnC0svPj+2mjOaUsTJ13z6vhopnUV68D+IaVSbdJgdUxEolvFUwdj1T5liiG93JuNQIBC1dTPTdM/mt3bFiVn669JvHP6wdtvy+M33dHyrQFWcGk9KKADw/XFwtLK4wXfDZRt4FrNbbFn3tnqRfm6N5vtHeZiL2E+7I2F0tg40nBNtinoDUdE7gMOR8NVCWNm/l83p0nIDYxcqxXzFuujmM8L0+hGwBEiqvzcKor5gXzcACONJX6A3vHX8YhOtEJGqsi5Qg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oQOvg01W3TJiQ162QSb6zujlWUsZFiIqYwj5yJHk0dIS0eaupWih1XrLvHFDs84mZsGmsd4noDbdHCoiXLF4rNqlJ+I6QxAUAZhA+oc8cEwCp1z9nigv/KHS6SLTciV67z8lZuy1mPOlBTCqfeTA3j349Rv2d2l9H/pSm38zm9YnQYYY1w3kKAW/Z8DlFVI7tR5o17V1JUKLJ5WK3IHRPhCunxIJKpE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.413416, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Nov 14, 2024 at 04:39:00PM -0500, Sid Kumar wrote: > >On 11/14/24 12:05 PM, Sidhartha Kumar wrote: [...] >> ================ results ========================= >> Bpftrace was used to profile the allocation path for requesting new maple >> nodes while running the ./mmap1_processes test from mmtests. The two paths >> for allocation are requests for a single node and the bulk allocation path. >> The histogram represents the number of calls to these paths and a shows the >> distribution of the number of nodes requested for the bulk allocation path. >> >> >> mm-unstable 11/13/24 >> @bulk_alloc_req: >> [2, 4) 10 |@@@@@@@@@@@@@ | >> [4, 8) 38 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| >> [8, 16) 19 |@@@@@@@@@@@@@@@@@@@@@@@@@@ | >> >> >> mm-unstable 11/13/24 + this series >> @bulk_alloc_req: >> [2, 4) 9 |@@@@@@@@@@ | >> [4, 8) 43 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| >> [8, 16) 15 |@@@@@@@@@@@@@@@@@@ | >> >> We can see the worst case bulk allocations of [8,16) nodes are reduced after >> this series. > >>From running the ./malloc1_threads test case we eliminate almost all bulk >allocation requests that > >fall between 8 and 16 nodes > >./malloc1_threads -t 8 -s 100 >mm-unstable + this series >@bulk_alloc_req: >[2, 4)                 2 |                                                    >| >[4, 8)              3381 >|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| >[8, 16)                2 |                                                    >| > This is impressive. But I come up one thing not clear. For mmap related code, we usually have the following usage: vma_iter_prealloc(vmi, vma); mas_preallocate(vmi->mas, vma); MA_WR_STATE(wr_mas, ); mas_wr_store_type(&wr_mas); --- (1) vma_iter_store(vmi, vma); Locaton (1) is where we try to get a better estimation of allocations. The estimation is based on we walk down the tree and try to meet a proper node. In mmap related code, we usually have already walked down the tree to leaf, by vma_find() or related iteration operation, and the mas.status is set to ma_active. To me, I don't expect mas_preallocate() would traverse the tree again. But from your result, it seems most cases do traverse the tree again to get a more precise height. Which part do you think I have missed? > >mm-unstable >@bulk_alloc_req: >[2, 4)                 1 |                                                    >| >[4, 8)              1427 |@@@@@@@@@@@@@@@@@@@@@@@@@@                          >| >[8, 16)             2790 >|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| > > >> >> Sidhartha Kumar (5): >> maple_tree: convert mas_prealloc_calc() to take in a maple write state >> maple_tree: use height and depth consistently >> maple_tree: use vacant nodes to reduce worst case allocations >> maple_tree: break on convergence in mas_spanning_rebalance() >> maple_tree: add sufficient height >> >> include/linux/maple_tree.h | 4 + >> lib/maple_tree.c | 89 +++++++++++++--------- >> tools/testing/radix-tree/maple.c | 125 +++++++++++++++++++++++++++++-- >> 3 files changed, 176 insertions(+), 42 deletions(-) >> -- Wei Yang Help you, Help me