[patch] optimize disk_round_stats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Following the same idea, it occurs to me that we should only update
disk stat when "now" is different from disk->stamp.  Otherwise, we
are again needlessly adding zero to the stats.


Signed-off-by: Ken Chen <[email protected]>

--- ./drivers/block/ll_rw_blk.c.orig	2005-10-13 11:54:07.474907379 -0700
+++ ./drivers/block/ll_rw_blk.c	2005-10-13 11:54:39.074516367 -0700
@@ -2433,6 +2433,9 @@ void disk_round_stats(struct gendisk *di
 {
 	unsigned long now = jiffies;
 
+	if (now == disk->stamp)
+		return;
+
 	if (disk->in_flight) {
 		__disk_stat_add(disk, time_in_queue,
 				disk->in_flight * (now - disk->stamp));



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux