mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Samuel Holland" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Samuel Holland <samuel.holland@sifive.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: irq/drivers] irqchip/riscv-imsic: Embed the vector array in lpriv
Date: Thu, 16 Oct 2025 15:46:34 -0000	[thread overview]
Message-ID: <176062959406.709179.4675912253469876151.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20251015195712.3813004-3-samuel.holland@sifive.com>

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     6efefb71195ae1c93913615bcf0e7c5a63083e35
Gitweb:        https://git.kernel.org/tip/6efefb71195ae1c93913615bcf0e7c5a63083e35
Author:        Samuel Holland <samuel.holland@sifive.com>
AuthorDate:    Wed, 15 Oct 2025 12:55:13 -07:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 16 Oct 2025 17:26:35 +02:00

irqchip/riscv-imsic: Embed the vector array in lpriv

Reduce pointer chasing and the number of allocations by using a flexible
array member for the vector array instead of a separate allocation.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-riscv-imsic-state.c | 10 ++--------
 drivers/irqchip/irq-riscv-imsic-state.h |  2 +-
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-riscv-imsic-state.c
index dc95ad8..9a499ef 100644
--- a/drivers/irqchip/irq-riscv-imsic-state.c
+++ b/drivers/irqchip/irq-riscv-imsic-state.c
@@ -487,7 +487,6 @@ static void __init imsic_local_cleanup(void)
 		lpriv = per_cpu_ptr(imsic->lpriv, cpu);
 
 		bitmap_free(lpriv->dirty_bitmap);
-		kfree(lpriv->vectors);
 	}
 
 	free_percpu(imsic->lpriv);
@@ -501,7 +500,8 @@ static int __init imsic_local_init(void)
 	int cpu, i;
 
 	/* Allocate per-CPU private state */
-	imsic->lpriv = alloc_percpu(typeof(*imsic->lpriv));
+	imsic->lpriv = __alloc_percpu(struct_size(imsic->lpriv, vectors, global->nr_ids + 1),
+				      __alignof__(*imsic->lpriv));
 	if (!imsic->lpriv)
 		return -ENOMEM;
 
@@ -521,12 +521,6 @@ static int __init imsic_local_init(void)
 		timer_setup(&lpriv->timer, imsic_local_timer_callback, TIMER_PINNED);
 #endif
 
-		/* Allocate vector array */
-		lpriv->vectors = kcalloc(global->nr_ids + 1, sizeof(*lpriv->vectors),
-					 GFP_KERNEL);
-		if (!lpriv->vectors)
-			goto fail_local_cleanup;
-
 		/* Setup vector array */
 		for (i = 0; i <= global->nr_ids; i++) {
 			vec = &lpriv->vectors[i];
diff --git a/drivers/irqchip/irq-riscv-imsic-state.h b/drivers/irqchip/irq-riscv-imsic-state.h
index 57f9519..196457f 100644
--- a/drivers/irqchip/irq-riscv-imsic-state.h
+++ b/drivers/irqchip/irq-riscv-imsic-state.h
@@ -40,7 +40,7 @@ struct imsic_local_priv {
 #endif
 
 	/* Local vector table */
-	struct imsic_vector			*vectors;
+	struct imsic_vector			vectors[];
 };
 
 struct imsic_priv {

  parent reply	other threads:[~2025-10-16 15:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 19:55 [PATCH 0/4] irqchip/riscv-imsic: IRQ handling optimizations Samuel Holland
2025-10-15 19:55 ` [PATCH 1/4] irqchip/riscv-imsic: Remove redundant irq_data lookups Samuel Holland
2025-10-16 12:55   ` [tip: irq/drivers] " tip-bot2 for Samuel Holland
2025-10-16 15:46   ` tip-bot2 for Samuel Holland
2025-10-16 19:01   ` tip-bot2 for Samuel Holland
2025-10-15 19:55 ` [PATCH 2/4] irqchip/riscv-imsic: Embed the vector array in lpriv Samuel Holland
2025-10-16 12:55   ` [tip: irq/drivers] " tip-bot2 for Samuel Holland
2025-10-16 15:46   ` tip-bot2 for Samuel Holland [this message]
2025-10-16 19:01   ` tip-bot2 for Samuel Holland
2025-10-15 19:55 ` [PATCH 3/4] irqchip/riscv-imsic: Inline imsic_vector_from_local_id() Samuel Holland
2025-10-16 12:55   ` [tip: irq/drivers] " tip-bot2 for Samuel Holland
2025-10-16 15:46   ` tip-bot2 for Samuel Holland
2025-10-16 19:01   ` tip-bot2 for Samuel Holland
2025-10-15 19:55 ` [PATCH 4/4] irqchip/riscv-imsic: Remove irq_desc lookup from hot path Samuel Holland
2025-10-16 10:01   ` Thomas Gleixner

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=176062959406.709179.4675912253469876151.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®