All of lore.kernel.org
 help / color / mirror / Atom feed
From: Momchil Velikov <velco@fadata.bg>
To: Mathijs Mohlmann <mathijs@knoware.nl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix loop with disabled tasklets
Date: 11 Nov 2001 17:56:22 +0200	[thread overview]
Message-ID: <87hes1qp21.fsf@fadata.bg> (raw)


Mathijs,

You may want to have a look at the following patches (tested by visual
inspection):

--- softirq.c.orig	Sun Nov 11 16:42:14 2001
+++ softirq.c	Sun Nov 11 16:59:44 2001
@@ -188,22 +188,17 @@ static void tasklet_action(struct softir
 
 		list = list->next;
 
+		if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
+			BUG();
+
 		if (tasklet_trylock(t)) {
-			if (!atomic_read(&t->count)) {
-				if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
-					BUG();
+			if (!atomic_read(&t->count))
 				t->func(t->data);
-				tasklet_unlock(t);
-				continue;
-			}
 			tasklet_unlock(t);
+			continue;
 		}
 
-		local_irq_disable();
-		t->next = tasklet_vec[cpu].list;
-		tasklet_vec[cpu].list = t;
-		__cpu_raise_softirq(cpu, TASKLET_SOFTIRQ);
-		local_irq_enable();
+		tasklet_schedule(t);
 	}
 }
 
@@ -222,22 +217,17 @@ static void tasklet_hi_action(struct sof
 
 		list = list->next;
 
+		if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
+			BUG();
+
 		if (tasklet_trylock(t)) {
-			if (!atomic_read(&t->count)) {
-				if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
-					BUG();
+			if (!atomic_read(&t->count))
 				t->func(t->data);
-				tasklet_unlock(t);
-				continue;
-			}
 			tasklet_unlock(t);
+			continue;
 		}
 
-		local_irq_disable();
-		t->next = tasklet_hi_vec[cpu].list;
-		tasklet_hi_vec[cpu].list = t;
-		__cpu_raise_softirq(cpu, HI_SOFTIRQ);
-		local_irq_enable();
+		tasklet_hi_schedule(t);
 	}
 }
 

--- interrupt.h.orig	Sun Nov 11 16:49:05 2001
+++ interrupt.h	Sun Nov 11 17:28:08 2001
@@ -185,13 +185,15 @@ static inline void tasklet_disable(struc
 static inline void tasklet_enable(struct tasklet_struct *t)
 {
 	smp_mb__before_atomic_dec();
-	atomic_dec(&t->count);
+	if (atomic_dec_and_test(&t->count))
+		tasklet_schedule(t);
 }
 
 static inline void tasklet_hi_enable(struct tasklet_struct *t)
 {
 	smp_mb__before_atomic_dec();
-	atomic_dec(&t->count);
+	if (atomic_dec_and_test(&t->count))
+		tasklet_hi_schedule(t);
 }
 
 extern void tasklet_kill(struct tasklet_struct *t);

Regards,
-velco

             reply	other threads:[~2001-11-11 15:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-11 15:56 Momchil Velikov [this message]
2001-11-12  7:46 ` [PATCH] fix loop with disabled tasklets Mathijs Mohlmann
2001-11-12  8:00   ` David S. Miller
2001-11-12  8:07   ` Momchil Velikov
2001-11-12  9:11     ` Mathijs Mohlmann
2001-11-12  9:41       ` Momchil Velikov
2001-11-12  9:54         ` Mathijs Mohlmann
  -- strict thread matches above, loose matches on Subject: below --
2001-11-12 15:33 Petr Vandrovec
2001-11-12 14:48 ` Andrea Arcangeli
2001-11-10 12:21 Mathijs Mohlmann
2001-11-10 13:37 ` David S. Miller
2001-11-10 15:03   ` Andrea Arcangeli
2001-11-10 15:29     ` Mathijs Mohlmann
2001-11-10 16:02       ` Alan Cox
2001-11-10 16:37       ` Andrea Arcangeli
2001-11-12  1:11         ` Andrea Arcangeli
2001-11-12  7:42           ` Mathijs Mohlmann
2001-11-12  7:59             ` David S. Miller
2001-11-12 14:03               ` Andrea Arcangeli
2001-11-12 13:57             ` Andrea Arcangeli
2001-11-12  8:03           ` David S. Miller
2001-11-12 14:04             ` Andrea Arcangeli
2001-11-12 14:20               ` Andrea Arcangeli
2001-11-12 17:10                 ` Thorsten Kukuk
2001-11-12 19:03                 ` Mathijs Mohlmann
2001-11-11  2:32     ` Mathijs Mohlmann

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=87hes1qp21.fsf@fadata.bg \
    --to=velco@fadata.bg \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathijs@knoware.nl \
    /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.