lkml.org 
[lkml]   [2006]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] account_system_vtime() should be a macro, not a function
Date
[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 <dada1@cosmosbay.com>
--- 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

/*
\
 
 \ /
  Last update: 2006-10-19 15:47    [W:0.111 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site