All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Adrian Huang <adrianhuang0701@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Adrian Huang <adrianhuang0701@gmail.com>,
	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: Mon, 25 Mar 2024 23:32:26 +0100	[thread overview]
Message-ID: <874jcueydh.ffs@tglx> (raw)
In-Reply-To: <20240325035102.15245-1-adrianhuang0701@gmail.com>

On Mon, Mar 25 2024 at 11:51, Adrian Huang wrote:
> * The following result is the average execution time of five-time
>   measurements about seq_read_iter().
>
>    no patch (us)     patched (us)     saved
>    -------------     ------------    -------
>           158552           148094       6.6%
>
> [1] https://gist.github.com/AdrianHuang/6c60b8053b2b3ecf6da56dec7a0eae70

These gist links are useless within no time and not of real value. We
all know that there are holes.

> Tested-by: Jiwei Sun <sunjw10@lenovo.com>
> Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
> ---
>  kernel/irq/proc.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
> index 623b8136e9af..756bdc1fd07b 100644
> --- a/kernel/irq/proc.c
> +++ b/kernel/irq/proc.c
> @@ -485,7 +485,14 @@ int show_interrupts(struct seq_file *p, void *v)
>  
>  	rcu_read_lock();
>  	desc = irq_to_desc(i);
> -	if (!desc || irq_settings_is_hidden(desc))
> +	if (!desc) {
> +		/* Try to jump over the unallocated irq hole. */
> +		*(int *) v = irq_get_next_irq(i + 1) - 1;

The position is loff_t and not int. See the type cast at the beginning
of that function. But let's leave this detail aside and let me ask the
real question:

Why are you not handling it at the place where the seq_file position is
iterated instead of doing this + 1 - 1 game here and getting the next
number only when you already ran into the hole?

That's the obvious place, no?

Thanks,

        tglx

  reply	other threads:[~2024-03-25 22:32 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 [this message]
2024-03-26 13:35   ` Huang Adrian
2024-03-26 23:36     ` Thomas Gleixner
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=874jcueydh.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 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.