[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG_fn=XZdT7k4fr7G5+-+DC9Oon-3y2PenyZomSiObbc4M=GQw@mail.gmail.com>
Date: Tue, 24 Oct 2023 13:56:18 +0200
From: Alexander Potapenko <glider@...gle.com>
To: Yury Norov <yury.norov@...il.com>
Cc: catalin.marinas@....com, will@...nel.org, pcc@...gle.com,
andreyknvl@...il.com, andriy.shevchenko@...ux.intel.com,
aleksander.lobakin@...el.com, linux@...musvillemoes.dk,
alexandru.elisei@....com, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, eugenis@...gle.com,
syednwaris@...il.com, william.gray@...aro.org
Subject: Re: [PATCH v8 2/2] lib/test_bitmap: add tests for bitmap_{read,write}()
> > +
> > +static void __init test_bitmap_write_perf(void)
> > +{
> > + DECLARE_BITMAP(bitmap, TEST_BIT_LEN);
> > + unsigned int cnt, nbits, i;
> > + unsigned long val = 0xfeedface;
> > + ktime_t time;
> > +
> > + bitmap_zero(bitmap, TEST_BIT_LEN);
> > + time = ktime_get();
> > + for (cnt = 0; cnt < 5; cnt++) {
> > + for (nbits = 1; nbits <= BITS_PER_LONG; nbits++) {
> > + for (i = 0; i < TEST_BIT_LEN; i++) {
> > + if (i + nbits > TEST_BIT_LEN)
> > + break;
> > + bitmap_write(bitmap, val, i, nbits);
> > + }
> > + }
> > + }
> > + time = ktime_get() - time;
> > + pr_err("Time spent in %s:\t%llu\n", __func__, time);
>
> For the perf part, can you add the output example to the commit
> message, and compare numbers with non-optimized for-loop()?
>
I don't understand the purpose of this comparison.
It is evident that bitmap_write() is faster than the non-optimized
loop doing BITS_PER_LONG reads and writes of a single bit.
It is moot how much faster the current implementation is, because the
loop implementation is just a concept describing the behavior of
bitmap_write().
My understanding was that the performance tests will help if someone
decides to optimize bitmap_write() further - in that case they would
be able to compare the performance before and after their changes.
But I fail to see how it helps to compare the current implementation
to something that is a priori slower.
Powered by blists - more mailing lists