[PATCH] account_system_vtime() should be a macro, not a function

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

 



[PATCH] account_system_vtime() should be a macro, not a function

Because the way 'current' is implemented on some archs, it's better to use a 
null macro for account_system_vtime(current) 

I discovered that gcc was (correctly) issuing one useless instruction (to 
load %rax with current from pda) on x86_64 on irq_enter() and __irq_exit()

This saves few bytes in kernel size, on archs where current is 'asm volatile'

Sample of asm code :

<smp_apic_timer_interrupt>:    
...
    callq  <exit_idle>
    mov    %gs:0x0,%rax // useless load of pda.'pcurrent' into %rax
    mov    %gs:0x10,%rax
    addl   $0x10000,0xffffffffffffe044(%rax) // 
add_preempt_count(HARDIRQ_OFFSET);

Signed-off-by: Eric Dumazet <[email protected]>
--- linux/include/linux/hardirq.h	2006-10-19 15:13:34.000000000 +0200
+++ linux-ed/include/linux/hardirq.h	2006-10-19 15:15:58.000000000 +0200
@@ -95,9 +95,11 @@
 struct task_struct;
 
 #ifndef CONFIG_VIRT_CPU_ACCOUNTING
-static inline void account_system_vtime(struct task_struct *tsk)
-{
-}
+/*
+ * It's better to provide a macro and not a function
+ * because the way 'current' is implemented on some archs
+ */
+#define account_system_vtime(X) do {} while (0)
 #endif
 
 /*

[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