public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Liao, Chang" <liaochang1@huawei.com>,
	Shanker Donthineni <sdonthineni@nvidia.com>,
	Marc Zyngier <maz@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Michael Walle <michael@walle.cc>,
	linux-kernel@vger.kernel.org, Vikram Sethi <vsethi@nvidia.com>,
	Jason Sequeira <jsequeira@nvidia.com>
Subject: Re: [PATCH v5 1/3] genirq: Use hlist for managing resend handlers
Date: Tue, 30 May 2023 14:19:21 +0200	[thread overview]
Message-ID: <87a5xmj9km.ffs@tglx> (raw)
In-Reply-To: <56c6dc9a-a5a6-368a-abd4-cace43ceaec0@huawei.com>

On Tue, May 30 2023 at 09:59, Chang Liao wrote:
> 在 2023/5/30 5:51, Thomas Gleixner 写道:
>>> What is the benefit of using hlist here? If you want to enjoy the
>>> low latency of querying elements by key, you must define a hlist table
>>> with a reasonable number of buckets. Otherwise, I don't think the time
>>> complexity of hlist is better than a regular double-linked list,
>>> right?
>> 
>> What's complex about hlist in this case? Please explain.
>
> Honestly, it is not about the complexity. Perhaps I do not understand the
> usage of hlist very deeply. I have searched some codes in the kernel and
> found that hlist is always used to speed up arbitrary querying, such as
> searching a registered kprobe by address. Back to this patch, these resend
> IRQs are organized in a sequence list actually, and traveled one by one to
> handle. Further, by comparing the difference between hlist_empty, hlist_add_head,
> hlist_del_init, and their counterparts in list, it looks like a regular linked
> list is also good enough.

Sure that works too.

The main difference between regular linked lists and hlist is that the
list head of hlist is half the size of a regular double linked list.

The only downside of hlist is that there is no back link in the list
head to the tail. Searching for the tail is O(N) while on a double
linked list it's O(1).

Nothing in this use case needs to access the tail. So what's your
problem?

Thanks,

        tglx

  reply	other threads:[~2023-05-30 12:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 13:48 [PATCH v5 0/3] Increase the number of IRQ descriptors for SPARSEIRQ Shanker Donthineni
2023-05-19 13:49 ` [PATCH v5 1/3] genirq: Use hlist for managing resend handlers Shanker Donthineni
2023-05-24 10:01   ` [tip: irq/core] " tip-bot2 for Shanker Donthineni
2023-05-29  7:57   ` [PATCH v5 1/3] " Liao, Chang
2023-05-29  8:48     ` Marc Zyngier
2023-05-30  1:44       ` Liao, Chang
2023-05-30  7:27         ` Marc Zyngier
2023-05-29 21:51     ` Thomas Gleixner
2023-05-30  1:59       ` Liao, Chang
2023-05-30 12:19         ` Thomas Gleixner [this message]
2023-06-02  1:36           ` Liao, Chang
2023-05-19 13:49 ` [PATCH v5 2/3] genirq: Encapsulate sparse bitmap handling Shanker Donthineni
2023-05-24 10:01   ` [tip: irq/core] " tip-bot2 for Shanker Donthineni
2023-05-19 13:49 ` [PATCH v5 3/3] genirq: Use the maple tree for IRQ descriptors management Shanker Donthineni
2023-05-24 10:01   ` [tip: irq/core] genirq: Use a maple tree for interrupt descriptor management tip-bot2 for Shanker Donthineni

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=87a5xmj9km.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=jsequeira@nvidia.com \
    --cc=liaochang1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=michael@walle.cc \
    --cc=sdonthineni@nvidia.com \
    --cc=vsethi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox