mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Remove needless BKL from release functions
@ 2001-11-21 23:32 David C. Hansen
  2001-11-22 10:12 ` Oliver Neukum
  0 siblings, 1 reply; 35+ messages in thread
From: David C. Hansen @ 2001-11-21 23:32 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Linus Torvalds, Alexander Viro, Rick Lindsley

  The following is a patch which removes the BKL from quite a few 
drivers' release functions.  The release functions are already 
serialized in the VFS code by an atomic_t which guarantees that each 
function will be called only once, after all file descriptors have been 
closed.  In addition, in these drivers, the BKL was _only_ held in the 
release function and nowhere else in the driver where it might be needed.

Many of these patches simply remove the BKL from the file.  This causes 
no harm because the BKL was not really protecting anything, anyway.  
Other patches try to actually fix the locking.  Some do this by making 
use of atomic operations with the atomic_* functions, or the 
(test|set)_bit functions.  Most of these patches replace uses of normal 
integers which were used to keep open counts in the drivers.  In other 
some cases, a spinlock was added when the atomic operations could not 
guarantee proper serialization by themselves.  And, in very few cases, 
the existing locking was extended to protect more things.  These cases 
are very uncommon because locking is very uncommon in most of these drivers.

Special care has been taken not to introduce more locking issues into 
the drivers (do no harm). They're available as one big patch which is 
against 2.4.14.  The big patch is about 50k, so, instead of attaching 
it, here is a link: http://lse.sourceforge.net/lockhier/patches/bkl.rollup
Here is documentation describing some of the patches and other locking 
issues in the drivers: http://lse.sourceforge.net/lockhier/
The patch applies against 2.4.14.

--
David C. Hansen
haveblue@us.ibm.com



^ permalink raw reply	[flat|nested] 35+ messages in thread
* [PATCH] lp.c, eexpress.c jiffies cleanup
@ 2001-11-06 20:04 Tim Schmielau
  2001-11-06 21:15 ` Andreas Dilger
  2001-11-06 21:37 ` Philip Blundell
  0 siblings, 2 replies; 35+ messages in thread
From: Tim Schmielau @ 2001-11-06 20:04 UTC (permalink / raw)
  To: Philip.Blundell; +Cc: Linus Torvalds, Alan Cox, linux-kernel, Andreas Dilger

Dear Philip, Linus, Alan,

one more jiffies cleanup patch to use comparison macros as pointed out by
Andreas Dilger on lkml.
I try to bundle files with the same maintainer to reduce email overhead.
If my procedure of mailing the maintainer as well as Cc:ing Linus and Alan
is incorrect, please drop me a short note.

In eexpress.c I also turned absolute jiffies number into multiples of HZ,
yet the resulting timeout values still do not always seem reasonable to
me.

Tim

--- ../linux-2.4.14-pre6/drivers/char/lp.c	Wed Oct 31 23:06:19 2001
+++ drivers/char/lp.c	Tue Nov  6 20:37:30 2001
@@ -302,7 +302,7 @@
 	size_t copy_size = count;

 #ifdef LP_STATS
-	if (jiffies-lp_table[minor].lastcall > LP_TIME(minor))
+	if (time_after(jiffies, lp_table[minor].lastcall + LP_TIME(minor)))
 		lp_table[minor].runchars = 0;

 	lp_table[minor].lastcall = jiffies;
--- ../linux-2.4.14-pre6/drivers/net/eexpress.c	Sun Sep 30 21:26:06 2001
+++ drivers/net/eexpress.c	Tue Nov  6 20:52:59 2001
@@ -504,7 +504,7 @@

 	if (lp->started)
 	{
-		if ((jiffies - dev->trans_start)>50)
+		if (time_after(jiffies, dev->trans_start + HZ/2))
 		{
 			if (lp->tx_link==lp->last_tx_restart)
 			{
@@ -560,7 +560,7 @@
 	}
 	else
 	{
-		if ((jiffies-lp->init_time)>10)
+		if (time_after(jiffies, lp->init_time + HZ/10))
 		{
 			unsigned short status = scb_status(dev);
 			printk(KERN_WARNING "%s: i82586 startup timed out, status %04x, resetting...\n",
@@ -725,8 +725,8 @@

 static void eexp_cmd_clear(struct net_device *dev)
 {
-	unsigned long int oldtime = jiffies;
-	while (scb_rdcmd(dev) && ((jiffies-oldtime)<10));
+	unsigned long timeout = jiffies + HZ/10;
+	while (scb_rdcmd(dev) && (time_before(jiffies, timeout)));
 	if (scb_rdcmd(dev)) {
 		printk("%s: command didn't clear\n", dev->name);
 	}
@@ -1598,16 +1598,16 @@
                 }
         }
         if (kick) {
-                unsigned long oj;
+                unsigned long timeout;
                 scb_command(dev, SCB_CUsuspend);
                 outb(0, ioaddr+SIGNAL_CA);
                 outb(0, ioaddr+SIGNAL_CA);
 #if 0
                 printk("%s: waiting for CU to go suspended\n", dev->name);
 #endif
-                oj = jiffies;
+                timeout = jiffies + 20*HZ;
                 while ((SCB_CUstat(scb_status(dev)) == 2) &&
-                       ((jiffies-oj) < 2000));
+                       time_before(jiffies, timeout));
 		if (SCB_CUstat(scb_status(dev)) == 2)
 			printk("%s: warning, CU didn't stop\n", dev->name);
                 lp->started &= ~(STARTED_CU);



^ permalink raw reply	[flat|nested] 35+ messages in thread
* RE: XFS to main kernel source
@ 2001-09-20 20:07 Gonyou, Austin
  2001-09-20 20:14 ` Alan Cox
  2001-09-20 20:29 ` Horst von Brand
  0 siblings, 2 replies; 35+ messages in thread
From: Gonyou, Austin @ 2001-09-20 20:07 UTC (permalink / raw)
  To: 'Alan Cox', narancs; +Cc: linux-xfs, linux-kernel

Won't there be a lot of changes which need to be made for it to go into 2.5
anyway though beyond just current development? Isn't 2.5 supposed to be
"radically" different?

-- 
Austin Gonyou
Systems Architect, CCNA
Coremetrics, Inc.
Phone: 512-796-9023
email: austin@coremetrics.com 

> -----Original Message-----
> From: Alan Cox [mailto:alan@lxorguk.ukuu.org.uk]
> Sent: Thursday, September 20, 2001 3:03 PM
> To: narancs@narancs.tii.matav.hu
> Cc: linux-xfs@oss.sgi.com; linux-kernel@vger.kernel.org
> Subject: Re: XFS to main kernel source
> 
> 
> > When will be the XFS patch integrated to main tree?
> > I'm really fed up with trying to get linux-2.4.9 + acXX or 
> preXX + xfs
> > together.
> 
> I can only speak for -ac but right now I have no plan to 
> tackle the merge
> except as an "its in 2.5, its ok in 2.5 backport" task
> 

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

end of thread, other threads:[~2001-11-26 19:56 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-21 23:32 [PATCH] Remove needless BKL from release functions David C. Hansen
2001-11-22 10:12 ` Oliver Neukum
2001-11-22 12:11   ` Christoph Hellwig
2001-11-22 12:30     ` Horst von Brand
2001-11-22 13:05       ` Christoph Hellwig
2001-11-23  9:44       ` Rick Lindsley
2001-11-23 10:10         ` Oliver.Neukum
2001-11-23 10:47           ` Christoph Hellwig
2001-11-23 11:24             ` Oliver Neukum
2001-11-26 17:46             ` David C. Hansen
2001-11-26 19:41               ` Flavio Stanchina
2001-11-26 19:53                 ` David C. Hansen
2001-11-23 12:08           ` Rick Lindsley
  -- strict thread matches above, loose matches on Subject: below --
2001-11-06 20:04 [PATCH] lp.c, eexpress.c jiffies cleanup Tim Schmielau
2001-11-06 21:15 ` Andreas Dilger
2001-11-06 21:37 ` Philip Blundell
2001-11-07  0:10   ` Andreas Dilger
2001-11-06 23:58     ` Tim Hockin
2001-09-20 20:07 XFS to main kernel source Gonyou, Austin
2001-09-20 20:14 ` Alan Cox
2001-09-20 20:16   ` Steve Lord
2001-09-20 20:25     ` Alan Cox
2001-09-20 20:26     ` Christoph Hellwig
2001-09-20 21:31       ` Steve Lord
2001-09-21  3:12         ` Andreas Dilger
2001-09-21  3:25           ` Steve Lord
2001-09-21  4:42             ` Nathan Scott
2001-09-21  5:58         ` Christoph Hellwig
2001-09-21  8:40           ` Narancs v1
2001-09-21 14:19         ` Alexander Viro
2001-09-21 14:45           ` Steve Lord
2001-09-20 20:40     ` Alexander Viro
2001-09-21 18:03       ` Steve Lord
2001-09-20 20:29 ` Horst von Brand
2001-09-20 20:50   ` Alan Cox

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®