diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc/kernel/process.c x/arch/ppc/kernel/process.c --- x-ref/arch/ppc/kernel/process.c 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc/kernel/process.c 2003-07-17 03:55:41.000000000 +0200 @@ -281,7 +281,7 @@ void show_regs(struct pt_regs * regs) #endif #ifdef CONFIG_SMP - printk(" CPU: %d", current->processor); + printk(" CPU: %d", current->cpu); #endif /* CONFIG_SMP */ printk("\n"); diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc/kernel/smp.c x/arch/ppc/kernel/smp.c --- x-ref/arch/ppc/kernel/smp.c 2003-06-13 22:07:24.000000000 +0200 +++ x/arch/ppc/kernel/smp.c 2003-07-17 03:55:41.000000000 +0200 @@ -47,6 +47,7 @@ spinlock_t kernel_flag __cacheline_align unsigned int prof_multiplier[NR_CPUS]; unsigned int prof_counter[NR_CPUS]; cycles_t cacheflush_time; +unsigned long cache_decay_ticks = 0; static int max_cpus __initdata = NR_CPUS; unsigned long cpu_online_map; int smp_hw_index[NR_CPUS]; @@ -292,9 +293,7 @@ void __init smp_boot_cpus(void) * cpu 0, the master -- Cort */ cpu_callin_map[0] = 1; - current->processor = 0; - - init_idle(); + current->cpu = 0; for (i = 0; i < NR_CPUS; i++) { prof_counter[i] = 1; @@ -351,12 +350,10 @@ void __init smp_boot_cpus(void) p = init_task.prev_task; if (!p) panic("No idle task for CPU %d", i); - del_from_runqueue(p); - unhash_process(p); - init_tasks[i] = p; - p->processor = i; - p->cpus_runnable = 1 << i; /* we schedule the first task manually */ + init_idle (p, i); + unhash_process(p); + p->cpu = i; current_set[i] = p; /* @@ -505,7 +502,7 @@ void __init smp_commence(void) void __init smp_callin(void) { - int cpu = current->processor; + int cpu = current->cpu; smp_store_cpu_info(cpu); smp_ops->setup_cpu(cpu); diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc/mm/init.c x/arch/ppc/mm/init.c --- x-ref/arch/ppc/mm/init.c 2003-06-13 22:07:24.000000000 +0200 +++ x/arch/ppc/mm/init.c 2003-07-17 03:55:41.000000000 +0200 @@ -167,9 +167,9 @@ void show_mem(void) { int iscur = 0; #ifdef CONFIG_SMP - printk("%3d ", p->processor); - if ( (p->processor != NO_PROC_ID) && - (p == current_set[p->processor]) ) + printk("%3d ", p->cpu); + if ( (p->cpu != NO_PROC_ID) && + (p == current_set[p->cpu]) ) { iscur = 1; printk("current"); diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/config.in x/arch/ppc64/config.in --- x-ref/arch/ppc64/config.in 2003-07-17 03:53:51.000000000 +0200 +++ x/arch/ppc64/config.in 2003-07-17 03:54:16.000000000 +0200 @@ -70,6 +70,8 @@ bool 'Networking support' CONFIG_NET bool 'Sysctl support' CONFIG_SYSCTL bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT +int 'Maximum User Real-Time Priority' CONFIG_MAX_USER_RT_PRIO 100 +int 'Maximum Kernel Real-time Priority' CONFIG_MAX_RT_PRIO 0 # only elf supported, a.out is not -- Cort if [ "$CONFIG_PROC_FS" = "y" ]; then diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/entry.S x/arch/ppc64/kernel/entry.S --- x-ref/arch/ppc64/kernel/entry.S 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc64/kernel/entry.S 2003-07-17 03:54:16.000000000 +0200 @@ -326,7 +326,7 @@ _GLOBAL(ret_to_user_hook) ld r3,NEED_RESCHED(r13) cmpi 0,r3,0 /* check need_resched flag */ beq+ 7f - bl .schedule + bl .do_schedule /* SIGPENDING is an int (32-bits) */ 7: lwz r5,SIGPENDING(r13) /* Check for pending unblocked signals */ diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/idle.c x/arch/ppc64/kernel/idle.c --- x-ref/arch/ppc64/kernel/idle.c 2003-07-17 03:53:51.000000000 +0200 +++ x/arch/ppc64/kernel/idle.c 2003-07-17 03:54:16.000000000 +0200 @@ -75,8 +75,6 @@ int idled(void) CTRL &= ~RUNLATCH; mtspr(CTRLT, CTRL); #endif - /* endless loop with no priority at all */ - init_idle(); lpaca = get_paca(); diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/pacaData.c x/arch/ppc64/kernel/pacaData.c --- x-ref/arch/ppc64/kernel/pacaData.c 2003-06-13 22:07:24.000000000 +0200 +++ x/arch/ppc64/kernel/pacaData.c 2003-07-17 03:54:16.000000000 +0200 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -64,6 +65,7 @@ struct systemcfg *systemcfg; }, \ exception_sp: \ (&paca[number].exception_stack[0]) - EXC_FRAME_SIZE, \ + pte_cache: LIST_HEAD_INIT(paca[number].pte_cache), \ } struct paca_struct paca[MAX_PACAS] __page_aligned = { diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/ppc_ksyms.c x/arch/ppc64/kernel/ppc_ksyms.c --- x-ref/arch/ppc64/kernel/ppc_ksyms.c 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc64/kernel/ppc_ksyms.c 2003-07-17 03:54:16.000000000 +0200 @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/process.c x/arch/ppc64/kernel/process.c --- x-ref/arch/ppc64/kernel/process.c 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc64/kernel/process.c 2003-07-17 03:54:16.000000000 +0200 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/rtasd.c x/arch/ppc64/kernel/rtasd.c --- x-ref/arch/ppc64/kernel/rtasd.c 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc64/kernel/rtasd.c 2003-07-17 03:54:16.000000000 +0200 @@ -783,7 +783,8 @@ static int rtasd(void *unused) /* Rusty unreal time task */ current->policy = SCHED_FIFO; - current->nice = sys_sched_get_priority_max(SCHED_FIFO) + 1; + /* XXX FIXME */ + /* current->nice = sys_sched_get_priority_max(SCHED_FIFO) + 1; */ cpu = 0; current->cpus_allowed = 1UL << cpu_logical_map(cpu); diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/smp.c x/arch/ppc64/kernel/smp.c --- x-ref/arch/ppc64/kernel/smp.c 2003-06-13 22:07:24.000000000 +0200 +++ x/arch/ppc64/kernel/smp.c 2003-07-17 03:54:16.000000000 +0200 @@ -69,6 +69,7 @@ extern atomic_t ipi_recv; extern atomic_t ipi_sent; spinlock_t kernel_flag __cacheline_aligned = SPIN_LOCK_UNLOCKED; cycles_t cacheflush_time; +unsigned long cache_decay_ticks = 0; static int max_cpus __initdata = NR_CPUS; unsigned long cpu_online_map; @@ -611,9 +612,7 @@ void __init smp_boot_cpus(void) * cpu 0, the master -- Cort */ cpu_callin_map[0] = 1; - current->processor = 0; - - init_idle(); + current->cpu = 0; for (i = 0; i < NR_CPUS; i++) { paca[i].prof_counter = 1; @@ -684,12 +683,11 @@ void __init smp_boot_cpus(void) PPCDBG(PPCDBG_SMP,"\tProcessor %d, task = 0x%lx\n", i, p); - del_from_runqueue(p); + init_idle(p, i); + unhash_process(p); - init_tasks[i] = p; - p->processor = i; - p->cpus_runnable = 1 << i; /* we schedule the first task manually */ + p->cpu = i; current_set[i].task = p; sp = ((unsigned long)p) + sizeof(union task_union) - STACK_FRAME_OVERHEAD; @@ -740,7 +738,7 @@ void __init smp_commence(void) void __init smp_callin(void) { - int cpu = current->processor; + int cpu = current->cpu; smp_store_cpu_info(cpu); set_dec(paca[cpu].default_decr); @@ -748,8 +746,6 @@ void __init smp_callin(void) ppc_md.smp_setup_cpu(cpu); - init_idle(); - set_bit(smp_processor_id(), &cpu_online_map); while(!smp_commenced) { @@ -768,7 +764,7 @@ int start_secondary(void *unused) { int cpu; - cpu = current->processor; + cpu = current->cpu; atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; smp_callin(); diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/kernel/sys_ppc32.c x/arch/ppc64/kernel/sys_ppc32.c --- x-ref/arch/ppc64/kernel/sys_ppc32.c 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc64/kernel/sys_ppc32.c 2003-07-17 03:54:16.000000000 +0200 @@ -454,32 +454,57 @@ out: return err; } +extern asmlinkage long sys_quotactl(int cmd, const char *special, int id, caddr_t addr); + +#ifdef CONFIG_QIFACE_COMPAT +#ifdef CONFIG_QIFACE_V1 struct user_dqblk32 { - __u32 dqb_bhardlimit; - __u32 dqb_bsoftlimit; - __u32 dqb_curblocks; - __u32 dqb_ihardlimit; - __u32 dqb_isoftlimit; - __u32 dqb_curinodes; - __kernel_time_t32 dqb_btime; - __kernel_time_t32 dqb_itime; + __u32 dqb_bhardlimit; + __u32 dqb_bsoftlimit; + __u32 dqb_curblocks; + __u32 dqb_ihardlimit; + __u32 dqb_isoftlimit; + __u32 dqb_curinodes; + __kernel_time_t32 dqb_btime; + __kernel_time_t32 dqb_itime; }; - +typedef struct v1c_mem_dqblk comp_dqblk_t; -extern asmlinkage long sys_quotactl(int cmd, const char *special, int id, caddr_t addr); +#define Q_COMP_GETQUOTA Q_V1_GETQUOTA +#define Q_COMP_SETQUOTA Q_V1_SETQUOTA +#define Q_COMP_SETQLIM Q_V1_SETQLIM +#define Q_COMP_SETUSE Q_V1_SETUSE +#else +struct user_dqblk32 { + __u32 dqb_ihardlimit; + __u32 dqb_isoftlimit; + __u32 dqb_curinodes; + __u32 dqb_bhardlimit; + __u32 dqb_bsoftlimit; + __u64 dqb_curspace; + __kernel_time_t32 dqb_btime; + __kernel_time_t32 dqb_itime; +}; +typedef struct v2c_mem_dqblk comp_dqblk_t; + +#define Q_COMP_GETQUOTA Q_V2_GETQUOTA +#define Q_COMP_SETQUOTA Q_V2_SETQUOTA +#define Q_COMP_SETQLIM Q_V2_SETQLIM +#define Q_COMP_SETUSE Q_V2_SETUSE +#endif /* Note: it is necessary to treat cmd and id as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ -asmlinkage long sys32_quotactl(u32 cmd_parm, const char *special, u32 id_parm, caddr_t addr) +asmlinkage long sys32_quotactl(u32 cmd_parm, const char *special, u32 id_parm, unsigned long addr) { - int cmd = (int)cmd_parm; - int id = (int)id_parm; + int cmd = (int)cmd_parm; + int id = (int)id_parm; int cmds = cmd >> SUBCMDSHIFT; int err; - struct v1c_mem_dqblk d; + comp_dqblk_t d; mm_segment_t old_fs; char *spec; @@ -487,42 +512,51 @@ asmlinkage long sys32_quotactl(u32 cmd_p current->pid, current, current->comm); switch (cmds) { - case Q_V1_GETQUOTA: + case Q_COMP_GETQUOTA: break; - case Q_V1_SETQUOTA: - case Q_V1_SETUSE: - case Q_V1_SETQLIM: - if (copy_from_user(&d, addr, sizeof(struct user_dqblk32))) + case Q_COMP_SETQUOTA: + case Q_COMP_SETUSE: + case Q_COMP_SETQLIM: + if (copy_from_user(&d, (struct user_dqblk32 *)addr, + sizeof (struct user_dqblk32))) return -EFAULT; d.dqb_itime = ((struct user_dqblk32 *)&d)->dqb_itime; d.dqb_btime = ((struct user_dqblk32 *)&d)->dqb_btime; break; default: - return sys_quotactl(cmd, special, id, addr); + return sys_quotactl(cmd, special, id, (__kernel_caddr_t)addr); } - spec = getname(special); + spec = getname (special); err = PTR_ERR(spec); - if (IS_ERR(spec)) - return err; - old_fs = get_fs(); + if (IS_ERR(spec)) return err; + old_fs = get_fs (); set_fs (KERNEL_DS); - err = sys_quotactl(cmd, (const char *)spec, id, (caddr_t)&d); + err = sys_quotactl(cmd, (const char *)spec, id, (__kernel_caddr_t)&d); set_fs (old_fs); putname (spec); - if (cmds == Q_V1_GETQUOTA) { + if (err) + return err; + if (cmds == Q_COMP_GETQUOTA) { __kernel_time_t b = d.dqb_btime, i = d.dqb_itime; ((struct user_dqblk32 *)&d)->dqb_itime = i; ((struct user_dqblk32 *)&d)->dqb_btime = b; - if (copy_to_user(addr, &d, sizeof(struct user_dqblk32))) + if (copy_to_user ((struct user_dqblk32 *)addr, &d, + sizeof (struct user_dqblk32))) return -EFAULT; } PPCDBG(PPCDBG_SYS32, "sys32_quotactl - exited - pid=%ld current=%lx comm=%s \n", current->pid, current, current->comm); - return err; + return 0; } - +#else +/* No conversion needed for new interface */ +asmlinkage int sys32_quotactl(int cmd, const char *special, int id, caddr_t addr) +{ + return sys_quotactl(cmd, special, id, addr); +} +#endif /* readdir & getdents */ diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/mm/fault.c x/arch/ppc64/mm/fault.c --- x-ref/arch/ppc64/mm/fault.c 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc64/mm/fault.c 2003-07-17 03:54:16.000000000 +0200 @@ -124,7 +124,7 @@ void do_page_fault(struct pt_regs *regs, goto bad_area; } vma = find_vma_prev(mm, address, &prev_vma); - if (expand_stack(vma, address)) { + if (expand_stack(vma, address, prev_vma)) { PPCDBG(PPCDBG_MM, "\tdo_page_fault: expand_stack\n"); goto bad_area; } diff -urNp --exclude CVS --exclude BitKeeper x-ref/arch/ppc64/mm/init.c x/arch/ppc64/mm/init.c --- x-ref/arch/ppc64/mm/init.c 2003-07-15 02:05:40.000000000 +0200 +++ x/arch/ppc64/mm/init.c 2003-07-17 03:54:16.000000000 +0200 @@ -113,8 +113,10 @@ int do_check_pgt_cache(int low, int high free_page((unsigned long)pgd_alloc_one_fast(0)), ++freed; if (pmd_quicklist) free_page((unsigned long)pmd_alloc_one_fast(0, 0)), ++freed; - if (pte_quicklist) - free_page((unsigned long)pte_alloc_one_fast(0, 0)), ++freed; + if (!list_empty(&pte_quicklist)) { + pte_free_slow(pte_alloc_one_fast_lifo(NULL, 0)); + freed++; + } } while (pgtable_cache_size > low); } return freed; diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc/smp.h x/include/asm-ppc/smp.h --- x-ref/include/asm-ppc/smp.h 2003-06-13 22:07:41.000000000 +0200 +++ x/include/asm-ppc/smp.h 2003-07-17 03:55:41.000000000 +0200 @@ -45,7 +45,7 @@ extern void smp_local_timer_interrupt(st #define cpu_logical_map(cpu) (cpu) #define cpu_number_map(x) (x) -#define smp_processor_id() (current->processor) +#define smp_processor_id() (current->cpu) extern int smp_hw_index[NR_CPUS]; #define hard_smp_processor_id() (smp_hw_index[smp_processor_id()]) diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc64/bitops.h x/include/asm-ppc64/bitops.h --- x-ref/include/asm-ppc64/bitops.h 2003-07-17 03:53:51.000000000 +0200 +++ x/include/asm-ppc64/bitops.h 2003-07-17 03:56:47.000000000 +0200 @@ -33,6 +33,7 @@ #ifdef __KERNEL__ +#include #include /* @@ -43,14 +44,14 @@ static __inline__ int test_bit(unsigned long nr, __const__ volatile unsigned long *addr) { - return (1UL & (((__const__ long *) addr)[nr >> 6] >> (nr & 63))); + return (1UL & (addr[nr >> 6] >> (nr & 63))); } static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr) { unsigned long old; unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); __asm__ __volatile__( "1: ldarx %0,0,%3 # set_bit\n\ @@ -66,7 +67,7 @@ static __inline__ void clear_bit(unsigne { unsigned long old; unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); __asm__ __volatile__( "1: ldarx %0,0,%3 # clear_bit\n\ @@ -82,7 +83,7 @@ static __inline__ void change_bit(unsign { unsigned long old; unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); __asm__ __volatile__( "1: ldarx %0,0,%3 # change_bit\n\ @@ -98,7 +99,7 @@ static __inline__ int test_and_set_bit(u { unsigned long old, t; unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); __asm__ __volatile__( EIEIO_ON_SMP @@ -118,7 +119,7 @@ static __inline__ int test_and_clear_bit { unsigned long old, t; unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); __asm__ __volatile__( EIEIO_ON_SMP @@ -138,7 +139,7 @@ static __inline__ int test_and_change_bi { unsigned long old, t; unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); __asm__ __volatile__( EIEIO_ON_SMP @@ -160,7 +161,7 @@ static __inline__ int test_and_change_bi static __inline__ void __set_bit(unsigned long nr, volatile unsigned long *addr) { unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); *p |= mask; } @@ -168,7 +169,7 @@ static __inline__ void __set_bit(unsigne static __inline__ void __clear_bit(unsigned long nr, volatile unsigned long *addr) { unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); *p &= ~mask; } @@ -176,7 +177,7 @@ static __inline__ void __clear_bit(unsig static __inline__ void __change_bit(unsigned long nr, volatile unsigned long *addr) { unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); *p ^= mask; } @@ -184,7 +185,7 @@ static __inline__ void __change_bit(unsi static __inline__ int __test_and_set_bit(unsigned long nr, volatile unsigned long *addr) { unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); unsigned long old = *p; *p = old | mask; @@ -194,7 +195,7 @@ static __inline__ int __test_and_set_bit static __inline__ int __test_and_clear_bit(unsigned long nr, volatile unsigned long *addr) { unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); unsigned long old = *p; *p = old & ~mask; @@ -204,7 +205,7 @@ static __inline__ int __test_and_clear_b static __inline__ int __test_and_change_bit(unsigned long nr, volatile unsigned long *addr) { unsigned long mask = 1UL << (nr & 0x3f); - unsigned long *p = ((unsigned long *)addr) + (nr >> 6); + volatile unsigned long *p = addr + (nr >> 6); unsigned long old = *p; *p = old ^ mask; @@ -286,6 +287,21 @@ static __inline__ int ffs(int x) #define fls(x) generic_fls(x) /* + * Every architecture must define this function. It's the fastest + * way of searching a 140-bit bitmap where the first 100 bits are + * unlikely to be set. It's guaranteed that at least one of the 140 + * bits is cleared. + */ +static inline int sched_find_first_bit(unsigned long *b) +{ + if (unlikely(b[0])) + return __ffs(b[0]); + if (unlikely(b[1])) + return __ffs(b[1]) + 64; + return __ffs(b[2]) + 128; +} + +/* * hweightN: returns the hamming weight (i.e. the number * of bits set) of a N-bit word */ diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc64/mman.h x/include/asm-ppc64/mman.h --- x-ref/include/asm-ppc64/mman.h 2003-03-15 03:25:16.000000000 +0100 +++ x/include/asm-ppc64/mman.h 2003-07-17 03:54:16.000000000 +0200 @@ -11,6 +11,7 @@ #define PROT_READ 0x1 /* page can be read */ #define PROT_WRITE 0x2 /* page can be written */ #define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_SEM 0x8 /* page may be used for atomic ops */ #define PROT_NONE 0x0 /* page can not be accessed */ #define MAP_SHARED 0x01 /* Share changes */ diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc64/paca.h x/include/asm-ppc64/paca.h --- x-ref/include/asm-ppc64/paca.h 2003-06-13 22:07:41.000000000 +0200 +++ x/include/asm-ppc64/paca.h 2003-07-17 03:54:16.000000000 +0200 @@ -18,6 +18,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ +#include #include #define N_EXC_STACK 2 @@ -92,11 +93,11 @@ struct paca_struct { */ u64 *pgd_cache; /* 0x00 */ u64 *pmd_cache; /* 0x08 */ - u64 *pte_cache; /* 0x10 */ - u64 pgtable_cache_sz; /* 0x18 */ - u64 next_jiffy_update_tb; /* TB value for next jiffy update 0x20 */ - u32 lpEvent_count; /* lpEvents processed 0x28 */ - u8 rsvd2[128-5*8-1*4]; /* 0x68 */ + struct list_head pte_cache; /* 0x10 */ + u64 pgtable_cache_sz; /* 0x20 */ + u64 next_jiffy_update_tb; /* TB value for next jiffy update 0x28 */ + u32 lpEvent_count; /* lpEvents processed 0x30 */ + u8 rsvd2[128-6*8-1*4]; /* 0x68 */ /*===================================================================================== * CACHE_LINE_3 0x0100 - 0x017F diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc64/pgalloc.h x/include/asm-ppc64/pgalloc.h --- x-ref/include/asm-ppc64/pgalloc.h 2003-03-15 03:25:16.000000000 +0100 +++ x/include/asm-ppc64/pgalloc.h 2003-07-17 03:54:16.000000000 +0200 @@ -2,6 +2,7 @@ #define _PPC64_PGALLOC_H #include +#include #include #include #include @@ -88,38 +89,50 @@ pmd_free (pmd_t *pmd) ++pgtable_cache_size; } -#define pmd_populate(MM, PMD, PTE) pmd_set(PMD, PTE) +#define pmd_populate(mm, pmd, page) do { *(pmd) = mk_pmd(page, NULL); } while (0) -static inline pte_t* -pte_alloc_one_fast (struct mm_struct *mm, unsigned long addr) +static inline struct page * pte_alloc_one_fast(struct mm_struct *mm, + unsigned long address) { - unsigned long *ret = (unsigned long *)pte_quicklist; + struct list_head * entry = pte_quicklist.next; /* FIFO */ + struct page * page = NULL; - if (ret != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = 0; - --pgtable_cache_size; + if (entry != &pte_quicklist) { + list_del(entry); + page = list_entry(entry, struct page, list); + pgtable_cache_size--; } - return (pte_t *)ret; + return page; } +static inline struct page * pte_alloc_one_fast_lifo(struct mm_struct *mm, + unsigned long address) +{ + struct list_head * entry = pte_quicklist.prev; /* LIFO */ + struct page * page = NULL; -static inline pte_t* -pte_alloc_one (struct mm_struct *mm, unsigned long addr) + if (entry != &pte_quicklist) { + list_del(entry); + page = list_entry(entry, struct page, list); + pgtable_cache_size--; + } + return page; +} + +static inline void pte_free(struct page * page) { - pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL); + list_add(&page->list, &pte_quicklist); + pgtable_cache_size++; +} - if (pte != NULL) - clear_page(pte); - return pte; +static __inline__ void pte_free_slow(struct page * page) +{ + __free_page(page); } -static inline void -pte_free (pte_t *pte) +static inline void pte_free_via_pmd(pmd_t pmd) { - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - ++pgtable_cache_size; + pte_free(virt_to_page(pte_offset(&pmd, 0))); } extern int do_check_pgt_cache(int, int); diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc64/pgtable.h x/include/asm-ppc64/pgtable.h --- x-ref/include/asm-ppc64/pgtable.h 2003-07-15 02:05:53.000000000 +0200 +++ x/include/asm-ppc64/pgtable.h 2003-07-17 03:54:16.000000000 +0200 @@ -189,6 +189,14 @@ extern unsigned long empty_zero_page[PAG pte; \ }) +#define mk_pmd(page, pgprot) \ +({ \ + pmd_t pmd; \ + \ + pmd_val(pmd) = (unsigned long)(page - mem_map); \ + pmd; \ +}) + #define pte_modify(_pte, newprot) \ (__pte((pte_val(_pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))) @@ -229,6 +237,16 @@ extern unsigned long empty_zero_page[PAG #define pte_offset(dir,addr) \ ((pte_t *) pmd_page(*(dir)) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) +#define pte_offset2(dir, address) pte_offset(dir, address) +#define pte_offset_atomic(dir, address) pte_offset(dir, address) +#define pte_offset_atomic2(dir, address) pte_offset(dir, address) +#define pte_offset_under_lock(dir, address, mm) pte_offset(dir, address) +#define pte_offset2_under_lock(dir, address, mm) pte_offset(dir, address) +#define pte_kunmap(ptep) do { } while(0) +#define pte_kunmap2(ptep) do { } while(0) +#define pte_kunmap_atomic2(ptep) do { } while(0) +#define pte_alloc_atomic(mm, pmd, address) pte_alloc(mm, pmd, address) + /* to find an entry in a kernel page-table-directory */ /* This now only contains the vmalloc pages */ #define pgd_offset_k(address) pgd_offset(&init_mm, address) diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc64/prefetch.h x/include/asm-ppc64/prefetch.h --- x-ref/include/asm-ppc64/prefetch.h 1970-01-01 01:00:00.000000000 +0100 +++ x/include/asm-ppc64/prefetch.h 2003-07-17 03:54:16.000000000 +0200 @@ -0,0 +1,23 @@ +#ifndef __ASM_PPC64_PREFETCH_H +#define __ASM_PPC64_PREFETCH_H + +/* + * Prefetch macros. + */ +#define ARCH_HAS_PREFETCH +#define ARCH_HAS_PREFETCHW +#define ARCH_HAS_SPINLOCK_PREFETCH + +static inline void prefetch(const void *x) +{ + __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x)); +} + +static inline void prefetchw(const void *x) +{ + __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x)); +} + +#define spin_lock_prefetch(x) prefetchw(x) + +#endif /* __ASM_PPC64_PREFETCH_H */ diff -urNp --exclude CVS --exclude BitKeeper x-ref/include/asm-ppc64/processor.h x/include/asm-ppc64/processor.h --- x-ref/include/asm-ppc64/processor.h 2003-07-15 02:05:53.000000000 +0200 +++ x/include/asm-ppc64/processor.h 2003-07-17 03:54:16.000000000 +0200 @@ -739,25 +739,6 @@ void free_task_struct(struct task_struct #define cpu_relax() udelay(1) -/* - * Prefetch macros. - */ -#define ARCH_HAS_PREFETCH -#define ARCH_HAS_PREFETCHW -#define ARCH_HAS_SPINLOCK_PREFETCH - -static inline void prefetch(const void *x) -{ - __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x)); -} - -static inline void prefetchw(const void *x) -{ - __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x)); -} - -#define spin_lock_prefetch(x) prefetchw(x) - #endif /* ASSEMBLY */ #endif /* __ASM_PPC64_PROCESSOR_H */