public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* softirq parameters
@ 2002-08-04 16:26 Matthew Wilcox
  2002-08-04 17:38 ` george anzinger
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew Wilcox @ 2002-08-04 16:26 UTC (permalink / raw)
  To: Alexey Kuznetsov, David S. Miller; +Cc: linux-kernel


what do you guys think about this patch?  nobody's using the data argument
to the softirq routines, but most of the routines want to know which
CPU they're running on.

also, we have:

static struct softirq_action softirq_vec[32] __cacheline_aligned_in_smp;

and i rather wonder why we cache-align them.  they only get initialised at
startup (kernel or module init), so this cacheline must be in shared state.

diff -urpNX dontdiff linux-2.5.30/drivers/scsi/scsi.c linux-2.5.30-willy/drivers/scsi/scsi.c
--- linux-2.5.30/drivers/scsi/scsi.c	2002-07-06 07:21:00.000000000 -0600
+++ linux-2.5.30-willy/drivers/scsi/scsi.c	2002-08-04 08:26:13.000000000 -0600
@@ -1192,9 +1192,8 @@ void scsi_done(Scsi_Cmnd * SCpnt)
  * interrupt latency, stack depth, and reentrancy of the low-level
  * drivers.
  */
-static void scsi_softirq(struct softirq_action *h)
+static void scsi_softirq(int cpu)
 {
-	int cpu = smp_processor_id();
 	struct softscsi_data *queue = &softscsi_data[cpu];
 
 	while (queue->head) {
@@ -2567,7 +2566,7 @@ static int __init init_scsi(void)
 	bus_register(&scsi_driverfs_bus_type);
 
 	/* Where we handle work queued by scsi_done */
-	open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL);
+	open_softirq(SCSI_SOFTIRQ, scsi_softirq);
 
 	return 0;
 }
diff -urpNX dontdiff linux-2.5.30/include/linux/interrupt.h linux-2.5.30-willy/include/linux/interrupt.h
--- linux-2.5.30/include/linux/interrupt.h	2002-07-27 12:09:21.000000000 -0600
+++ linux-2.5.30-willy/include/linux/interrupt.h	2002-07-27 12:12:52.000000000 -0600
@@ -77,12 +77,11 @@ enum
 
 struct softirq_action
 {
-	void	(*action)(struct softirq_action *);
-	void	*data;
+	void	(*action)(int cpu);
 };
 
 asmlinkage void do_softirq(void);
-extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
+extern void open_softirq(int nr, void (*action)(int cpu));
 extern void softirq_init(void);
 #define __cpu_raise_softirq(cpu, nr) do { softirq_pending(cpu) |= 1UL << (nr); } while (0)
 extern void FASTCALL(cpu_raise_softirq(unsigned int cpu, unsigned int nr));
diff -urpNX dontdiff linux-2.5.30/kernel/softirq.c linux-2.5.30-willy/kernel/softirq.c
--- linux-2.5.30/kernel/softirq.c	2002-08-02 05:44:53.000000000 -0600
+++ linux-2.5.30-willy/kernel/softirq.c	2002-08-02 05:45:35.000000000 -0600
@@ -86,7 +86,7 @@ restart:
 
 		do {
 			if (pending & 1)
-				h->action(h);
+				h->action(cpu);
 			h++;
 			pending >>= 1;
 		} while (pending);
@@ -136,9 +136,8 @@ void raise_softirq(unsigned int nr)
 	local_irq_restore(flags);
 }
 
-void open_softirq(int nr, void (*action)(struct softirq_action*), void *data)
+void open_softirq(int nr, void (*action)(int cpu))
 {
-	softirq_vec[nr].data = data;
 	softirq_vec[nr].action = action;
 }
 
@@ -176,7 +175,7 @@ void __tasklet_hi_schedule(struct taskle
 	local_irq_restore(flags);
 }
 
-static void tasklet_action(struct softirq_action *a)
+static void tasklet_action(int cpu)
 {
 	struct tasklet_struct *list;
 
@@ -209,7 +208,7 @@ static void tasklet_action(struct softir
 	}
 }
 
-static void tasklet_hi_action(struct softirq_action *a)
+static void tasklet_hi_action(int cpu)
 {
 	struct tasklet_struct *list;
 
@@ -321,8 +320,8 @@ void __init softirq_init()
 	for (i=0; i<32; i++)
 		tasklet_init(bh_task_vec+i, bh_action, i);
 
-	open_softirq(TASKLET_SOFTIRQ, tasklet_action, NULL);
-	open_softirq(HI_SOFTIRQ, tasklet_hi_action, NULL);
+	open_softirq(TASKLET_SOFTIRQ, tasklet_action);
+	open_softirq(HI_SOFTIRQ, tasklet_hi_action);
 }
 
 void __run_task_queue(task_queue *list)
diff -urpNX dontdiff linux-2.5.30/net/core/dev.c linux-2.5.30-willy/net/core/dev.c
--- linux-2.5.30/net/core/dev.c	2002-06-20 16:53:53.000000000 -0600
+++ linux-2.5.30-willy/net/core/dev.c	2002-06-29 09:10:38.000000000 -0600
@@ -1333,10 +1333,8 @@ static __inline__ void skb_bond(struct s
 		skb->dev = dev->master;
 }
 
-static void net_tx_action(struct softirq_action *h)
+static void net_tx_action(int cpu)
 {
-	int cpu = smp_processor_id();
-
 	if (softnet_data[cpu].completion_queue) {
 		struct sk_buff *clist;
 
@@ -1573,9 +1571,8 @@ job_done:
 	return 0;
 }
 
-static void net_rx_action(struct softirq_action *h)
+static void net_rx_action(int this_cpu)
 {
-	int this_cpu = smp_processor_id();
 	struct softnet_data *queue = &softnet_data[this_cpu];
 	unsigned long start_time = jiffies;
 	int budget = netdev_max_backlog;
@@ -2816,8 +2813,8 @@ static int __init net_dev_init(void)
 
 	dev_boot_phase = 0;
 
-	open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
-	open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);
+	open_softirq(NET_TX_SOFTIRQ, net_tx_action);
+	open_softirq(NET_RX_SOFTIRQ, net_rx_action);
 
 	dst_init();
 	dev_mcast_init();

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-08-08  5:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-04 16:26 softirq parameters Matthew Wilcox
2002-08-04 17:38 ` george anzinger
2002-08-05  5:37   ` David S. Miller
2002-08-07  5:24     ` Rusty Russell
2002-08-07 18:23       ` Matthew Wilcox
2002-08-07 18:18         ` David S. Miller
2002-08-07 18:35           ` Matthew Wilcox
2002-08-07 18:24             ` David S. Miller
2002-08-08  2:29               ` Rusty Russell
2002-08-08  5:13         ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox