Skip to content

Commit

Permalink
softirq: Remove unused 'action' parameter from action callback
Browse files Browse the repository at this point in the history
When soft interrupt actions are called, they are passed a pointer to the
struct softirq action which contains the action's function pointer.

This pointer isn't useful, as the action callback already knows what
function it is. And since each callback handles a specific soft interrupt,
the callback also knows which soft interrupt number is running.

No soft interrupt action callback actually uses this parameter, so remove
it from the function pointer signature. This clarifies that soft interrupt
actions are global routines and makes it slightly cheaper to call them.

Signed-off-by: Caleb Sander Mateos <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Jens Axboe <[email protected]>
Link: https://lore.kernel.org/all/[email protected]
  • Loading branch information
calebsander authored and KAGA-KOKO committed Aug 20, 2024
1 parent 24d02c4 commit e68ac2b
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ static void blk_complete_reqs(struct llist_head *list)
rq->q->mq_ops->complete(rq);
}

static __latent_entropy void blk_done_softirq(struct softirq_action *h)
static __latent_entropy void blk_done_softirq(void)
{
blk_complete_reqs(this_cpu_ptr(&blk_cpu_done));
}
Expand Down
4 changes: 2 additions & 2 deletions include/linux/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ extern const char * const softirq_to_name[NR_SOFTIRQS];

struct softirq_action
{
void (*action)(struct softirq_action *);
void (*action)(void);
};

asmlinkage void do_softirq(void);
Expand All @@ -609,7 +609,7 @@ static inline void do_softirq_post_smp_call_flush(unsigned int unused)
}
#endif

extern void open_softirq(int nr, void (*action)(struct softirq_action *));
extern void open_softirq(int nr, void (*action)(void));
extern void softirq_init(void);
extern void __raise_softirq_irqoff(unsigned int nr);

Expand Down
2 changes: 1 addition & 1 deletion kernel/rcu/tiny.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static inline bool rcu_reclaim_tiny(struct rcu_head *head)
}

/* Invoke the RCU callbacks whose grace period has elapsed. */
static __latent_entropy void rcu_process_callbacks(struct softirq_action *unused)
static __latent_entropy void rcu_process_callbacks(void)
{
struct rcu_head *next, *list;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion kernel/rcu/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ static __latent_entropy void rcu_core(void)
queue_work_on(rdp->cpu, rcu_gp_wq, &rdp->strict_work);
}

static void rcu_core_si(struct softirq_action *h)
static void rcu_core_si(void)
{
rcu_core();
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -12483,7 +12483,7 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf)
* - indirectly from a remote scheduler_tick() for NOHZ idle balancing
* through the SMP cross-call nohz_csd_func()
*/
static __latent_entropy void sched_balance_softirq(struct softirq_action *h)
static __latent_entropy void sched_balance_softirq(void)
{
struct rq *this_rq = this_rq();
enum cpu_idle_type idle = this_rq->idle_balance;
Expand Down
15 changes: 7 additions & 8 deletions kernel/softirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ static void handle_softirqs(bool ksirqd)
kstat_incr_softirqs_this_cpu(vec_nr);

trace_softirq_entry(vec_nr);
h->action(h);
h->action();
trace_softirq_exit(vec_nr);
if (unlikely(prev_count != preempt_count())) {
pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
Expand Down Expand Up @@ -700,7 +700,7 @@ void __raise_softirq_irqoff(unsigned int nr)
or_softirq_pending(1UL << nr);
}

void open_softirq(int nr, void (*action)(struct softirq_action *))
void open_softirq(int nr, void (*action)(void))
{
softirq_vec[nr].action = action;
}
Expand Down Expand Up @@ -760,8 +760,7 @@ static bool tasklet_clear_sched(struct tasklet_struct *t)
return false;
}

static void tasklet_action_common(struct softirq_action *a,
struct tasklet_head *tl_head,
static void tasklet_action_common(struct tasklet_head *tl_head,
unsigned int softirq_nr)
{
struct tasklet_struct *list;
Expand Down Expand Up @@ -805,16 +804,16 @@ static void tasklet_action_common(struct softirq_action *a,
}
}

static __latent_entropy void tasklet_action(struct softirq_action *a)
static __latent_entropy void tasklet_action(void)
{
workqueue_softirq_action(false);
tasklet_action_common(a, this_cpu_ptr(&tasklet_vec), TASKLET_SOFTIRQ);
tasklet_action_common(this_cpu_ptr(&tasklet_vec), TASKLET_SOFTIRQ);
}

static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
static __latent_entropy void tasklet_hi_action(void)
{
workqueue_softirq_action(true);
tasklet_action_common(a, this_cpu_ptr(&tasklet_hi_vec), HI_SOFTIRQ);
tasklet_action_common(this_cpu_ptr(&tasklet_hi_vec), HI_SOFTIRQ);
}

void tasklet_setup(struct tasklet_struct *t,
Expand Down
2 changes: 1 addition & 1 deletion kernel/time/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now,
}
}

static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h)
static __latent_entropy void hrtimer_run_softirq(void)
{
struct hrtimer_cpu_base *cpu_base = this_cpu_ptr(&hrtimer_bases);
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion kernel/time/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2440,7 +2440,7 @@ static void run_timer_base(int index)
/*
* This function runs timers and the timer-tq in bottom half context.
*/
static __latent_entropy void run_timer_softirq(struct softirq_action *h)
static __latent_entropy void run_timer_softirq(void)
{
run_timer_base(BASE_LOCAL);
if (IS_ENABLED(CONFIG_NO_HZ_COMMON)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/irq_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void irq_poll_complete(struct irq_poll *iop)
}
EXPORT_SYMBOL(irq_poll_complete);

static void __latent_entropy irq_poll_softirq(struct softirq_action *h)
static void __latent_entropy irq_poll_softirq(void)
{
struct list_head *list = this_cpu_ptr(&blk_cpu_iopoll);
int rearm = 0, budget = irq_poll_budget;
Expand Down
4 changes: 2 additions & 2 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5247,7 +5247,7 @@ int netif_rx(struct sk_buff *skb)
}
EXPORT_SYMBOL(netif_rx);

static __latent_entropy void net_tx_action(struct softirq_action *h)
static __latent_entropy void net_tx_action(void)
{
struct softnet_data *sd = this_cpu_ptr(&softnet_data);

Expand Down Expand Up @@ -6920,7 +6920,7 @@ static int napi_threaded_poll(void *data)
return 0;
}

static __latent_entropy void net_rx_action(struct softirq_action *h)
static __latent_entropy void net_rx_action(void)
{
struct softnet_data *sd = this_cpu_ptr(&softnet_data);
unsigned long time_limit = jiffies +
Expand Down

0 comments on commit e68ac2b

Please sign in to comment.