From: Thomas Gleixner <tglx@linutronix.de>
To: Huang Adrian <adrianhuang0701@gmail.com>
Cc: linux-kernel@vger.kernel.org, Jiwei Sun <sunjw10@lenovo.com>,
Adrian Huang <ahuang12@lenovo.com>
Subject: Re: [PATCH 1/1] genirq/proc: Try to jump over the unallocated irq hole whenever possible
Date: Wed, 27 Mar 2024 00:36:57 +0100 [thread overview]
Message-ID: <87h6gsefae.ffs@tglx> (raw)
In-Reply-To: <CAHKZfL1xq-pemEMo7m8DctEVxSG_ASQWxCC_HsN=-92UAjP_Mw@mail.gmail.com>
On Tue, Mar 26 2024 at 21:35, Huang Adrian wrote:
> On Tue, Mar 26, 2024 at 6:32 AM Thomas Gleixner <tglx@linutronix.de> wrote:
> The reason I made the changes in show_interrupts() is to minimize the
> traversal times of the 'sparse_irqs' maple tree since irq_to_desc() is
> invoked in show_interrupts().
They are not really relevant. The cache line is hot after the
irq_get_next_irq() lookup and maple tree is a highly optimized data
structure.
I'm not saying that it is free, but if you want to avoid that in the
first place then you need to do a lookup of the next descriptor and hand
it into show_interrupts() right away and not just hack some completely
obscure optimization into show_interrupts().
> @@ -19,6 +19,10 @@ static void *int_seq_next(struct seq_file *f, void
> *v, loff_t *pos)
[ 3 more citation lines. Click/Enter to show. ]
> (*pos)++;
> if (*pos > nr_irqs)
> return NULL;
> +
> + if (!irq_to_desc(*pos))
> + *pos = irq_get_next_irq(*pos);
How is irq_get_next_irq() valid without either holding the sparse irq
lock or RCU read lock?
Testing this with full debug enabled might give you the answer to that
question.
But that aside you are missing a massive performance problem in the
generic show_interrupts() code:
if (desc->kstat_irqs) {
for_each_online_cpu(j)
any_count |= data_race(*per_cpu_ptr(desc->kstat_irqs, j));
}
if ((!desc->action || irq_desc_is_chained(desc)) && !any_count)
goto outsparse;
There are two obvious problems with that, no?
Thanks,
tglx
next prev parent reply other threads:[~2024-03-26 23:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 3:51 [PATCH 1/1] genirq/proc: Try to jump over the unallocated irq hole whenever possible Adrian Huang
2024-03-25 22:32 ` Thomas Gleixner
2024-03-26 13:35 ` Huang Adrian
2024-03-26 23:36 ` Thomas Gleixner [this message]
2024-03-28 10:03 ` Huang Adrian
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=87h6gsefae.ffs@tglx \
--to=tglx@linutronix.de \
--cc=adrianhuang0701@gmail.com \
--cc=ahuang12@lenovo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sunjw10@lenovo.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