mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Linux kernel <linux-kernel@vger.kernel.org>
Subject: 2.4.24 extra CPU cycles in scsi.c
Date: Thu, 19 Feb 2004 11:18:30 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.53.0402191116550.500@chaos> (raw)


When looking through various modules that I use, trying to
find out where some memory seems to be leaking, I found a
couple of unrelated things in scsi.c.

The code sets a structure-member to NULL, then releases the
pointer to that structure. A few CPU cycles being thrown away.
Since I was reviewing the whole file, I also got rid of the
spurious casts when calling kfree().



--- linux-2.4.24/drivers/scsi/scsi.c.orig	Thu Feb 19 10:45:20 2004
+++ linux-2.4.24/drivers/scsi/scsi.c	Thu Feb 19 11:01:47 2004
@@ -314,11 +314,7 @@
 void scsi_release_request(Scsi_Request * req)
 {
 	if( req->sr_command != NULL )
-	{
 		scsi_release_command(req->sr_command);
-		req->sr_command = NULL;
-	}
-
 	kfree(req);
 }

@@ -1449,7 +1445,7 @@
  	spin_lock_irqsave(&device_request_lock, flags);
 	for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCnext) {
 		SDpnt->device_queue = SCnext = SCpnt->next;
-		kfree((char *) SCpnt);
+		kfree(SCpnt);
 	}
 	SDpnt->has_cmdblocks = 0;
 	SDpnt->queue_depth = 0;
@@ -1550,7 +1546,7 @@
 	    max_scsi_hosts = n+1;
 	}
 	else
-	    kfree((char *) shn);
+	    kfree(shn);
     }
 }

@@ -1845,7 +1841,7 @@
 				HBA_ptr->host_queue = scd->next;
 			}
 			blk_cleanup_queue(&scd->request_queue);
-			kfree((char *) scd);
+			kfree(scd);
 		} else {
 			goto out;
 		}
@@ -2164,7 +2160,7 @@
 			blk_cleanup_queue(&SDpnt->request_queue);
 			/* Next free up the Scsi_Device structures for this host */
 			shpnt->host_queue = SDpnt->next;
-			kfree((char *) SDpnt);
+			kfree(SDpnt);

 		}
 	}


Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



             reply	other threads:[~2004-02-19 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-19 16:18 Richard B. Johnson [this message]
2004-04-05 18:37 ` 2.6.5, ACPI, suspend and ThinkPad R40 Biker

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=Pine.LNX.4.53.0402191116550.500@chaos \
    --to=root@chaos.analogic.com \
    --cc=linux-kernel@vger.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®