1 ////////////////////////////////////////////////////////////////////////////////////
6 // This file is C source for SWAP driver.
9 // AUTHOR: L.Komkov, S.Grekhov, A.Gerenkov
10 // COMPANY NAME: Samsung Research Center in Moscow
11 // DEPT NAME: Advanced Software Group
12 // CREATED: 2008.02.15
14 // REVISION DATE: 2008.12.03
16 ////////////////////////////////////////////////////////////////////////////////////
21 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
22 #define tcp_opt tcp_sock
25 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
26 #define kmem_cache_t struct kmem_cache
30 #define UNUSED __attribute__((unused))
32 #define USER_PRIO(p) ((p)-MAX_RT_PRIO)
33 #define MAX_USER_PRIO (USER_PRIO(MAX_PRIO))
35 #define PRIO_BONUS_RATIO 25
36 #define MAX_BONUS (MAX_USER_PRIO * PRIO_BONUS_RATIO / 100)
37 #define INTERACTIVE_DELTA 2
39 #define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
40 #define TASK_NICE(p) PRIO_TO_NICE((p)->static_prio)
42 #define SCALE(v1,v1_max,v2_max) (v1) * (v2_max) / (v1_max)
44 #define DELTA(p) (SCALE(TASK_NICE(p), 40, MAX_BONUS) + INTERACTIVE_DELTA)
46 #define TASK_INTERACTIVE(p) ((p)->prio <= (p)->static_prio - DELTA(p))
49 const char *ec_probe_name[] = {