From: Yury Norov <ynorov@nvidia.com>
To: Gary Guo <gary@garyguo.net>
Cc: "Eliot Courtney" <ecourtney@nvidia.com>,
"Greg KH" <gregkh@linuxfoundation.org>,
"Burak Emir" <bqe@google.com>,
"John Hubbard" <jhubbard@nvidia.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Liam R . Howlett" <liam@infradead.org>,
"Andrew Ballance" <andrewjballance@gmail.com>,
"Matthew Wilcox" <willy@infradead.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Benno Lossin" <lossin@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Boqun Feng" <boqun@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Onur Özkan" <work@onurozkan.dev>,
"Simona Vetter" <simona@ffwll.ch>,
"Tamir Duberstein" <tamird@kernel.org>,
"Timur Tabi" <ttabi@nvidia.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Yury Norov" <yury.norov@gmail.com>, "Zhi Wang" <zhiw@nvidia.com>,
maple-tree@lists.infradead.org, linux-kernel@vger.kernel.org,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v2] lib: test bitmap vs IDA vs Maple Tree performance for region allocations
Date: Wed, 15 Jul 2026 11:54:23 -0400 [thread overview]
Message-ID: <aletL7odX7uIDPxD@yury> (raw)
In-Reply-To: <alcT3HupA6TogWSa@yury>
On Wed, Jul 15, 2026 at 01:00:12AM -0400, Yury Norov wrote:
> On Sat, Jul 11, 2026 at 02:51:28PM +0100, Gary Guo wrote:
>
> ...
>
> > > +static unsigned long __init benchmark_bitmap(unsigned long capacity)
> > > +{
> > > + unsigned long count, index;
> > > + ktime_t alloc_time, free_time;
> > > + size_t memory;
> > > +
> > > + bitmap_zero(alloc_bitmap, MAP_SIZE);
> > > + alloc_time = ktime_get();
> >
> > To eliminate possible effects of optimization messing up benchmark, please add a
> > barrier() after start timing and a barrier() before end timing. Probably you'd
> > want one between each loop iteration too.
>
> It was never a problem in find_bit_benchmark test, but OK.
So, I ran some experiments: 5 times with barriers, and 5 times without,
and repeated it for reverse order of capacities.
The results are:
Experiment 1,000,000 100,000
Bitmap allocate −0.28% (p=.631) −5.63% (p=.0039)
Bitmap release +0.89% (p=.247) −1.30% (p=.089)
IDA allocate −0.03% (p=.971) −19.98% (p=.035)
IDA release −0.27% (p=.315) +1.38% (p=.165)
Maple allocate +0.09% (p=.579) −1.06% (p=.529)
Maple release −0.54% (p=.315) +0.03% (p=.971)
10,000 1,000
Bitmap allocate +5.19% (p=.853) −3.17% (p=.739)
Bitmap release −2.16% (p=.853) −0.45% (p=.912)
IDA allocate −3.42% (p=.247) −6.80% (p=.190)
IDA release −1.21% (p=.315) −5.39% (p=.063)
Maple allocate −1.81% (p=.529) −0.32% (p=.529)
Maple release +1.39% (p=.739) +0.11% (p=.631)
The barriers were only present in allocation loops, so release
measurements serve as a negative control. Most effects are small
and statistically insignificant.
Two allocation comparisons have unadjusted p < .05, but both show
barriers making execution faster. Across all 24 comparisons, neither
survives Holm/Bonferroni correction; the smallest adjusted p-value
is approximately .093.
Codegeneration-wise, both objects have:
- Identical text size: 2,413 bytes.
- Identical instruction count.
- No additional loads, spills, or fences.
The barriers only changed scheduling of a few independent instructions:
- Bitmap: loop-counter increment moved across __bitmap_set().
- IDA: counter increment and ID accumulation swapped.
- Maple Tree: region_indexes[] store moved relative to the
loop-bound comparison.
There is no code-generation change capable to produce visible performance
impact.
With all that, I'll drop the barriers. Instead, I've added the
WARN_ON(!xxx_empty()) after the release completion for the data
structures: to ensure the release is not optimized, and to
additionally enforce integrity.
Thanks,
Yury
prev parent reply other threads:[~2026-07-15 15:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 6:36 [PATCH v2] lib: test bitmap vs IDA vs Maple Tree performance for region allocations Yury Norov
2026-07-11 6:44 ` sashiko-bot
2026-07-11 8:27 ` Onur Özkan
2026-07-15 1:49 ` Yury Norov
2026-07-11 13:51 ` Gary Guo
2026-07-15 5:00 ` Yury Norov
2026-07-15 15:54 ` Yury Norov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aletL7odX7uIDPxD@yury \
--to=ynorov@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=andrewjballance@gmail.com \
--cc=apopple@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=bqe@google.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=maple-tree@lists.infradead.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=willy@infradead.org \
--cc=work@onurozkan.dev \
--cc=yury.norov@gmail.com \
--cc=zhiw@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.