The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Matthew Sakai <msakai@redhat.com>
Cc: dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	jserv@ccns.ncku.edu.tw
Subject: Re: Potential heapify performance issue in dm-vdo
Date: Thu, 22 May 2025 15:22:24 +0800	[thread overview]
Message-ID: <aC7QsLCPEt9nm5Pd@visitorckw-System-Product-Name> (raw)
In-Reply-To: <9501613e-e8e5-4734-aa2f-ca3a3e4ca990@redhat.com>

On Wed, May 21, 2025 at 02:57:26PM -0400, Matthew Sakai wrote:
> 
> 
> On 5/21/25 11:04 AM, Kuan-Wei Chiu wrote:
> > Hi Matthew,
> > 
> > Recently noticed that the current heapify method in min_heap.h may
> > degrade performance when the heap contains many compare-equal elements,
> > compared to the previous version.
> > 
> > In detail, the new heapify reduces the number of comparisons by about
> > 50% when all elements are distinct. However, when all elements are
> > equal, the comparison count can degrade from O(1) to O(log n).
> > 
> > I don't have enough domain knowledge of dm-vdo, so I'd like to ask
> > whether it uses heaps with many compare-equal elements. If so, I'll
> > work on fixing the issue.
> > 
> > Regards,
> > Kuan-Wei
> 
> Hi Kuan-Wei,
> 
> dm-vdo uses heapify for two different operations, but in both cases we
> define heap elements that can never be equal to each other. So I think this
> is not an issue for dm-vdo. (We have not noticed any issues with this in our
> regular testing, either.)
>
Thanks for confirming that dm-vdo won't encounter this issue.

We observed a regression in bcache caused by this behavior, and Coly
was concerned that dm-vdo might be affected in a similar way.
Fortunately, that doesn't seem to be the case.

Regards,
Kuan-Wei

      reply	other threads:[~2025-05-22  7:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 15:04 Potential heapify performance issue in dm-vdo Kuan-Wei Chiu
2025-05-21 18:57 ` Matthew Sakai
2025-05-22  7:22   ` Kuan-Wei Chiu [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=aC7QsLCPEt9nm5Pd@visitorckw-System-Product-Name \
    --to=visitorckw@gmail.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msakai@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox