Re: statistics infrastructure (in -mm tree) review

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

 



Andi Kleen wrote:
Greg KH <[email protected]> writes:
+ * exploiters don't update several statistics of the same entity in one go.
+ */
+static inline void statistic_add(struct statistic *stat, int i,
+				 s64 value, u64 incr)
+{
+	unsigned long flags;
+	local_irq_save(flags);
+	if (stat[i].state == STATISTIC_STATE_ON)
+		stat[i].add(&stat[i], smp_processor_id(), value, incr);


Indirect call in statistics hotpath? You know how slow this is on IA64 and even on other architectures it tends to disrupt the pipeline.

Okay, let's try to improve it then. The options here are:

a) Replace the indirect function call by a switch statement which directly
   calls the add function of the data processing mode chosen by user.
   (e.g. simple counter, histogram, utilisation indicator etc.).

   No loss in functionality, slightly uglier code, acceptable performance(?).
   This would be my choice.

b) Export statistic_add_counter(), statistic_add_histogram() and the like
   as part of the programming API (maybe in addition to the flexible
   statistic_add()) for those exploiters that definitively can't effort
   branching into a function.

   Loss in functionality (exploiting kernel code dictates how users see the
   data), a bit faster than option a).

What do you think? Did I miss an option?

Thanks, Martin


-
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