From cfae1b11bab20af38dfdbc3780f1e9941a5781be Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Wed, 4 Nov 2009 02:50:06 -0800 Subject: [PATCH] --- yaml --- r: 168263 b: refs/heads/master c: 4c3da2209b1261af9a948b7509a38904c8eee554 h: refs/heads/master i: 168261: 326d61af1003afec7165578253da78ecea1d0261 168259: bd14d5277c8b4ff5f4d2a40ed3697cb42efb2a69 168255: c7a8ffad72edd31cc777ecafa8ee6bcb3bb47e48 v: v3 --- [refs] | 2 +- trunk/arch/m32r/Kconfig | 3 - trunk/arch/m32r/boot/compressed/Makefile | 16 +-- trunk/arch/m32r/boot/compressed/misc.c | 143 ++++++++++++++++++----- trunk/arch/m32r/kernel/smp.c | 2 +- trunk/arch/m32r/kernel/time.c | 6 +- trunk/arch/m32r/kernel/vmlinux.lds.S | 2 - trunk/arch/x86/include/asm/amd_iommu.h | 1 - trunk/arch/x86/include/asm/processor.h | 2 +- trunk/arch/x86/include/asm/topology.h | 2 +- trunk/arch/x86/kernel/amd_iommu.c | 2 - trunk/arch/x86/kernel/amd_iommu_init.c | 24 +--- trunk/arch/x86/kernel/cpu/mtrr/cleanup.c | 2 +- trunk/arch/x86/kernel/process_64.c | 5 - trunk/arch/x86/kernel/reboot.c | 8 -- trunk/drivers/edac/amd64_edac.c | 6 +- trunk/drivers/misc/sgi-gru/gruprocfs.c | 13 +-- trunk/fs/compat.c | 2 - trunk/fs/sysfs/dir.c | 4 + trunk/kernel/kthread.c | 23 ++++ trunk/kernel/sched.c | 40 +------ trunk/kernel/sched_fair.c | 73 +++++------- trunk/kernel/trace/ftrace.c | 6 +- trunk/kernel/trace/ring_buffer.c | 2 - trunk/lib/dma-debug.c | 6 +- 25 files changed, 201 insertions(+), 194 deletions(-) diff --git a/[refs] b/[refs] index 82cf26c51dbb..540b3b6282b4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 608221fdf9a2170962295dcfbea53dc5c50d1a74 +refs/heads/master: 4c3da2209b1261af9a948b7509a38904c8eee554 diff --git a/trunk/arch/m32r/Kconfig b/trunk/arch/m32r/Kconfig index 3a9319f93e89..c41234f1b825 100644 --- a/trunk/arch/m32r/Kconfig +++ b/trunk/arch/m32r/Kconfig @@ -11,9 +11,6 @@ config M32R select HAVE_IDE select HAVE_OPROFILE select INIT_ALL_POSSIBLE - select HAVE_KERNEL_GZIP - select HAVE_KERNEL_BZIP2 - select HAVE_KERNEL_LZMA config SBUS bool diff --git a/trunk/arch/m32r/boot/compressed/Makefile b/trunk/arch/m32r/boot/compressed/Makefile index 1003880d0dfd..560484ae35ec 100644 --- a/trunk/arch/m32r/boot/compressed/Makefile +++ b/trunk/arch/m32r/boot/compressed/Makefile @@ -4,8 +4,8 @@ # create a compressed vmlinux image from the original vmlinux # -targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ - vmlinux.bin.lzma head.o misc.o piggy.o vmlinux.lds +targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \ + piggy.o vmlinux.lds OBJECTS = $(obj)/head.o $(obj)/misc.o @@ -27,12 +27,6 @@ $(obj)/vmlinux.bin: vmlinux FORCE $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE $(call if_changed,gzip) -$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE - $(call if_changed,bzip2) - -$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE - $(call if_changed,lzma) - CFLAGS_misc.o += -fpic ifdef CONFIG_MMU @@ -43,9 +37,5 @@ endif OBJCOPYFLAGS += -R .empty_zero_page -suffix_$(CONFIG_KERNEL_GZIP) = gz -suffix_$(CONFIG_KERNEL_BZIP2) = bz2 -suffix_$(CONFIG_KERNEL_LZMA) = lzma - -$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE $(call if_changed,ld) diff --git a/trunk/arch/m32r/boot/compressed/misc.c b/trunk/arch/m32r/boot/compressed/misc.c index 370d60881977..d394292498c0 100644 --- a/trunk/arch/m32r/boot/compressed/misc.c +++ b/trunk/arch/m32r/boot/compressed/misc.c @@ -9,49 +9,140 @@ * Adapted for SH by Stuart Menefy, Aug 1999 * * 2003-02-12: Support M32R by Takeo Takahashi + * This is based on arch/sh/boot/compressed/misc.c. */ +#include + /* * gzip declarations */ + +#define OF(args) args #define STATIC static #undef memset #undef memcpy #define memzero(s, n) memset ((s), 0, (n)) +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; + +#define WSIZE 0x8000 /* Window size must be at least 32k, */ + /* and a power of two */ + +static uch *inbuf; /* input buffer */ +static uch window[WSIZE]; /* Sliding window buffer */ + +static unsigned insize = 0; /* valid bytes in inbuf */ +static unsigned inptr = 0; /* index of next byte to be processed in inbuf */ +static unsigned outcnt = 0; /* bytes in output buffer */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define RESERVED 0xC0 /* bit 6,7: reserved */ + +#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) + +/* Diagnostic functions */ +#ifdef DEBUG +# define Assert(cond,msg) {if(!(cond)) error(msg);} +# define Trace(x) fprintf x +# define Tracev(x) {if (verbose) fprintf x ;} +# define Tracevv(x) {if (verbose>1) fprintf x ;} +# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} +# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + +static int fill_inbuf(void); +static void flush_window(void); static void error(char *m); +static unsigned char *input_data; +static int input_len; + +static long bytes_out = 0; +static uch *output_data; +static unsigned long output_ptr = 0; + #include "m32r_sio.c" static unsigned long free_mem_ptr; static unsigned long free_mem_end_ptr; -#ifdef CONFIG_KERNEL_BZIP2 -static void *memset(void *s, int c, size_t n) +#define HEAP_SIZE 0x10000 + +#include "../../../../lib/inflate.c" + +void* memset(void* s, int c, size_t n) { - char *ss = s; + int i; + char *ss = (char*)s; - while (n--) - *ss++ = c; + for (i=0;i> 8); + } + crc = c; + bytes_out += (ulg)outcnt; + output_ptr += (ulg)outcnt; + outcnt = 0; +} static void error(char *x) { @@ -62,20 +153,20 @@ static void error(char *x) while(1); /* Halt */ } +/* return decompressed size */ void decompress_kernel(int mmu_on, unsigned char *zimage_data, unsigned int zimage_len, unsigned long heap) { - unsigned char *input_data = zimage_data; - int input_len = zimage_len; - unsigned char *output_data; - output_data = (unsigned char *)CONFIG_MEMORY_START + 0x2000 + (mmu_on ? 0x80000000 : 0); free_mem_ptr = heap; - free_mem_end_ptr = free_mem_ptr + BOOT_HEAP_SIZE; + free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; + input_data = zimage_data; + input_len = zimage_len; - puts("\nDecompressing Linux... "); - decompress(input_data, input_len, NULL, NULL, output_data, NULL, error); - puts("done.\nBooting the kernel.\n"); + makecrc(); + puts("Uncompressing Linux... "); + gunzip(); + puts("Ok, booting the kernel.\n"); } diff --git a/trunk/arch/m32r/kernel/smp.c b/trunk/arch/m32r/kernel/smp.c index 31cef20b2996..8a88f1f0a3e2 100644 --- a/trunk/arch/m32r/kernel/smp.c +++ b/trunk/arch/m32r/kernel/smp.c @@ -806,7 +806,7 @@ unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, if (mask & ~physids_coerce(phys_cpu_present_map)) BUG(); - if (ipi_num >= NR_IPIS || ipi_num < 0) + if (ipi_num >= NR_IPIS) BUG(); mask <<= IPI_SHIFT; diff --git a/trunk/arch/m32r/kernel/time.c b/trunk/arch/m32r/kernel/time.c index 9cedcef11575..e7fee0f198d5 100644 --- a/trunk/arch/m32r/kernel/time.c +++ b/trunk/arch/m32r/kernel/time.c @@ -75,7 +75,7 @@ u32 arch_gettimeoffset(void) count = 0; count = (latch - count) * TICK_SIZE; - elapsed_time = DIV_ROUND_CLOSEST(count, latch); + elapsed_time = (count + latch / 2) / latch; /* NOTE: LATCH is equal to the "interval" value (= reload count). */ #else /* CONFIG_SMP */ @@ -93,7 +93,7 @@ u32 arch_gettimeoffset(void) p_count = count; count = (latch - count) * TICK_SIZE; - elapsed_time = DIV_ROUND_CLOSEST(count, latch); + elapsed_time = (count + latch / 2) / latch; /* NOTE: LATCH is equal to the "interval" value (= reload count). */ #endif /* CONFIG_SMP */ #elif defined(CONFIG_CHIP_M32310) @@ -211,7 +211,7 @@ void __init time_init(void) bus_clock = boot_cpu_data.bus_clock; divide = boot_cpu_data.timer_divide; - latch = DIV_ROUND_CLOSEST(bus_clock/divide, HZ); + latch = (bus_clock/divide + HZ / 2) / HZ; printk("Timer start : latch = %ld\n", latch); diff --git a/trunk/arch/m32r/kernel/vmlinux.lds.S b/trunk/arch/m32r/kernel/vmlinux.lds.S index 7da94eaa082b..8ceb6181d805 100644 --- a/trunk/arch/m32r/kernel/vmlinux.lds.S +++ b/trunk/arch/m32r/kernel/vmlinux.lds.S @@ -42,8 +42,6 @@ SECTIONS _etext = .; /* End of text section */ EXCEPTION_TABLE(16) - NOTES - RODATA RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) _edata = .; /* End of data section */ diff --git a/trunk/arch/x86/include/asm/amd_iommu.h b/trunk/arch/x86/include/asm/amd_iommu.h index 4b180897e6b5..ac95995b7bad 100644 --- a/trunk/arch/x86/include/asm/amd_iommu.h +++ b/trunk/arch/x86/include/asm/amd_iommu.h @@ -31,7 +31,6 @@ extern irqreturn_t amd_iommu_int_handler(int irq, void *data); extern void amd_iommu_flush_all_domains(void); extern void amd_iommu_flush_all_devices(void); extern void amd_iommu_shutdown(void); -extern void amd_iommu_apply_erratum_63(u16 devid); #else static inline int amd_iommu_init(void) { return -ENODEV; } static inline void amd_iommu_detect(void) { } diff --git a/trunk/arch/x86/include/asm/processor.h b/trunk/arch/x86/include/asm/processor.h index c9786480f0fe..c3429e8b2424 100644 --- a/trunk/arch/x86/include/asm/processor.h +++ b/trunk/arch/x86/include/asm/processor.h @@ -1000,7 +1000,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8)) #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1) -extern unsigned long KSTK_ESP(struct task_struct *task); +#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ #endif /* CONFIG_X86_64 */ extern void start_thread(struct pt_regs *regs, unsigned long new_ip, diff --git a/trunk/arch/x86/include/asm/topology.h b/trunk/arch/x86/include/asm/topology.h index 40e37b10c6c0..d823c245f63b 100644 --- a/trunk/arch/x86/include/asm/topology.h +++ b/trunk/arch/x86/include/asm/topology.h @@ -143,7 +143,7 @@ extern unsigned long node_remap_size[]; | 1*SD_BALANCE_FORK \ | 0*SD_BALANCE_WAKE \ | 1*SD_WAKE_AFFINE \ - | 0*SD_PREFER_LOCAL \ + | 1*SD_PREFER_LOCAL \ | 0*SD_SHARE_CPUPOWER \ | 0*SD_POWERSAVINGS_BALANCE \ | 0*SD_SHARE_PKG_RESOURCES \ diff --git a/trunk/arch/x86/kernel/amd_iommu.c b/trunk/arch/x86/kernel/amd_iommu.c index 0285521e0a99..98f230f6a28d 100644 --- a/trunk/arch/x86/kernel/amd_iommu.c +++ b/trunk/arch/x86/kernel/amd_iommu.c @@ -1220,8 +1220,6 @@ static void __detach_device(struct protection_domain *domain, u16 devid) amd_iommu_dev_table[devid].data[1] = 0; amd_iommu_dev_table[devid].data[2] = 0; - amd_iommu_apply_erratum_63(devid); - /* decrease reference counter */ domain->dev_cnt -= 1; diff --git a/trunk/arch/x86/kernel/amd_iommu_init.c b/trunk/arch/x86/kernel/amd_iommu_init.c index c20001e4f556..b4b61d462dcc 100644 --- a/trunk/arch/x86/kernel/amd_iommu_init.c +++ b/trunk/arch/x86/kernel/amd_iommu_init.c @@ -240,7 +240,7 @@ static void iommu_feature_enable(struct amd_iommu *iommu, u8 bit) writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET); } -static void iommu_feature_disable(struct amd_iommu *iommu, u8 bit) +static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit) { u32 ctrl; @@ -519,26 +519,6 @@ static void set_dev_entry_bit(u16 devid, u8 bit) amd_iommu_dev_table[devid].data[i] |= (1 << _bit); } -static int get_dev_entry_bit(u16 devid, u8 bit) -{ - int i = (bit >> 5) & 0x07; - int _bit = bit & 0x1f; - - return (amd_iommu_dev_table[devid].data[i] & (1 << _bit)) >> _bit; -} - - -void amd_iommu_apply_erratum_63(u16 devid) -{ - int sysmgt; - - sysmgt = get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1) | - (get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2) << 1); - - if (sysmgt == 0x01) - set_dev_entry_bit(devid, DEV_ENTRY_IW); -} - /* Writes the specific IOMMU for a device into the rlookup table */ static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid) { @@ -567,8 +547,6 @@ static void __init set_dev_entry_from_acpi(struct amd_iommu *iommu, if (flags & ACPI_DEVFLAG_LINT1) set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS); - amd_iommu_apply_erratum_63(devid); - set_iommu_for_device(iommu, devid); } diff --git a/trunk/arch/x86/kernel/cpu/mtrr/cleanup.c b/trunk/arch/x86/kernel/cpu/mtrr/cleanup.c index 73c86db5acbe..315738c74aad 100644 --- a/trunk/arch/x86/kernel/cpu/mtrr/cleanup.c +++ b/trunk/arch/x86/kernel/cpu/mtrr/cleanup.c @@ -846,7 +846,7 @@ int __init mtrr_cleanup(unsigned address_bits) sort(range, nr_range, sizeof(struct res_range), cmp_range, NULL); range_sums = sum_ranges(range, nr_range); - printk(KERN_INFO "total RAM covered: %ldM\n", + printk(KERN_INFO "total RAM coverred: %ldM\n", range_sums >> (20 - PAGE_SHIFT)); if (mtrr_chunk_size && mtrr_gran_size) { diff --git a/trunk/arch/x86/kernel/process_64.c b/trunk/arch/x86/kernel/process_64.c index eb62cbcaa490..ad535b683170 100644 --- a/trunk/arch/x86/kernel/process_64.c +++ b/trunk/arch/x86/kernel/process_64.c @@ -664,8 +664,3 @@ long sys_arch_prctl(int code, unsigned long addr) return do_arch_prctl(current, code, addr); } -unsigned long KSTK_ESP(struct task_struct *task) -{ - return (test_tsk_thread_flag(task, TIF_IA32)) ? - (task_pt_regs(task)->sp) : ((task)->thread.usersp); -} diff --git a/trunk/arch/x86/kernel/reboot.c b/trunk/arch/x86/kernel/reboot.c index f93078746e00..a1a3cdda06e1 100644 --- a/trunk/arch/x86/kernel/reboot.c +++ b/trunk/arch/x86/kernel/reboot.c @@ -436,14 +436,6 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5"), }, }, - { /* Handle problems with rebooting on Apple Macmini3,1 */ - .callback = set_pci_reboot, - .ident = "Apple Macmini3,1", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Macmini3,1"), - }, - }, { } }; diff --git a/trunk/drivers/edac/amd64_edac.c b/trunk/drivers/edac/amd64_edac.c index a38831c82649..d4560d9d5a83 100644 --- a/trunk/drivers/edac/amd64_edac.c +++ b/trunk/drivers/edac/amd64_edac.c @@ -2254,7 +2254,7 @@ static inline void __amd64_decode_bus_error(struct mem_ctl_info *mci, { u32 ec = ERROR_CODE(info->nbsl); u32 xec = EXT_ERROR_CODE(info->nbsl); - int ecc_type = (info->nbsh >> 13) & 0x3; + int ecc_type = info->nbsh & (0x3 << 13); /* Bail early out if this was an 'observed' error */ if (PP(ec) == K8_NBSL_PP_OBS) @@ -3163,7 +3163,7 @@ static int __init amd64_edac_init(void) opstate_init(); if (cache_k8_northbridges() < 0) - return err; + goto err_exit; err = pci_register_driver(&amd64_pci_driver); if (err) @@ -3189,6 +3189,8 @@ static int __init amd64_edac_init(void) err_2nd_stage: debugf0("2nd stage failed\n"); + +err_exit: pci_unregister_driver(&amd64_pci_driver); return err; diff --git a/trunk/drivers/misc/sgi-gru/gruprocfs.c b/trunk/drivers/misc/sgi-gru/gruprocfs.c index 3f2375c5ba5b..ccd4408a26c7 100644 --- a/trunk/drivers/misc/sgi-gru/gruprocfs.c +++ b/trunk/drivers/misc/sgi-gru/gruprocfs.c @@ -161,15 +161,14 @@ static int options_show(struct seq_file *s, void *p) static ssize_t options_write(struct file *file, const char __user *userbuf, size_t count, loff_t *data) { - char buf[20]; + unsigned long val; + char buf[80]; - if (count >= sizeof(buf)) - return -EINVAL; - if (copy_from_user(buf, userbuf, count)) + if (strncpy_from_user(buf, userbuf, sizeof(buf) - 1) < 0) return -EFAULT; - buf[count] = '\0'; - if (strict_strtoul(buf, 0, &gru_options)) - return -EINVAL; + buf[count - 1] = '\0'; + if (!strict_strtoul(buf, 10, &val)) + gru_options = val; return count; } diff --git a/trunk/fs/compat.c b/trunk/fs/compat.c index 6c19040ffeef..d576b552e8e2 100644 --- a/trunk/fs/compat.c +++ b/trunk/fs/compat.c @@ -1532,8 +1532,6 @@ int compat_do_execve(char * filename, if (retval < 0) goto out; - current->stack_start = current->mm->start_stack; - /* execve succeeded */ current->fs->in_exec = 0; current->in_execve = 0; diff --git a/trunk/fs/sysfs/dir.c b/trunk/fs/sysfs/dir.c index 5fad489ce5bc..e0201837d244 100644 --- a/trunk/fs/sysfs/dir.c +++ b/trunk/fs/sysfs/dir.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "sysfs.h" DEFINE_MUTEX(sysfs_mutex); @@ -285,6 +286,9 @@ void release_sysfs_dirent(struct sysfs_dirent * sd) sysfs_put(sd->s_symlink.target_sd); if (sysfs_type(sd) & SYSFS_COPY_NAME) kfree(sd->s_name); + if (sd->s_iattr && sd->s_iattr->ia_secdata) + security_release_secctx(sd->s_iattr->ia_secdata, + sd->s_iattr->ia_secdata_len); kfree(sd->s_iattr); sysfs_free_ino(sd->s_ino); kmem_cache_free(sysfs_dir_cachep, sd); diff --git a/trunk/kernel/kthread.c b/trunk/kernel/kthread.c index ab7ae57773e1..5fe709982caa 100644 --- a/trunk/kernel/kthread.c +++ b/trunk/kernel/kthread.c @@ -149,6 +149,29 @@ struct task_struct *kthread_create(int (*threadfn)(void *data), } EXPORT_SYMBOL(kthread_create); +/** + * kthread_bind - bind a just-created kthread to a cpu. + * @k: thread created by kthread_create(). + * @cpu: cpu (might not be online, must be possible) for @k to run on. + * + * Description: This function is equivalent to set_cpus_allowed(), + * except that @cpu doesn't need to be online, and the thread must be + * stopped (i.e., just returned from kthread_create()). + */ +void kthread_bind(struct task_struct *k, unsigned int cpu) +{ + /* Must have done schedule() in kthread() before we set_task_cpu */ + if (!wait_task_inactive(k, TASK_UNINTERRUPTIBLE)) { + WARN_ON(1); + return; + } + set_task_cpu(k, cpu); + k->cpus_allowed = cpumask_of_cpu(cpu); + k->rt.nr_cpus_allowed = 1; + k->flags |= PF_THREAD_BOUND; +} +EXPORT_SYMBOL(kthread_bind); + /** * kthread_stop - stop a thread created by kthread_create(). * @k: thread created by kthread_create(). diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 28dd4f490bfc..a455dca884a6 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -1992,38 +1992,6 @@ static inline void check_class_changed(struct rq *rq, struct task_struct *p, p->sched_class->prio_changed(rq, p, oldprio, running); } -/** - * kthread_bind - bind a just-created kthread to a cpu. - * @k: thread created by kthread_create(). - * @cpu: cpu (might not be online, must be possible) for @k to run on. - * - * Description: This function is equivalent to set_cpus_allowed(), - * except that @cpu doesn't need to be online, and the thread must be - * stopped (i.e., just returned from kthread_create()). - * - * Function lives here instead of kthread.c because it messes with - * scheduler internals which require locking. - */ -void kthread_bind(struct task_struct *p, unsigned int cpu) -{ - struct rq *rq = cpu_rq(cpu); - unsigned long flags; - - /* Must have done schedule() in kthread() before we set_task_cpu */ - if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE)) { - WARN_ON(1); - return; - } - - spin_lock_irqsave(&rq->lock, flags); - set_task_cpu(p, cpu); - p->cpus_allowed = cpumask_of_cpu(cpu); - p->rt.nr_cpus_allowed = 1; - p->flags |= PF_THREAD_BOUND; - spin_unlock_irqrestore(&rq->lock, flags); -} -EXPORT_SYMBOL(kthread_bind); - #ifdef CONFIG_SMP /* * Is this task likely cache-hot: @@ -2036,7 +2004,7 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd) /* * Buddy candidates are cache hot: */ - if (sched_feat(CACHE_HOT_BUDDY) && this_rq()->nr_running && + if (sched_feat(CACHE_HOT_BUDDY) && (&p->se == cfs_rq_of(&p->se)->next || &p->se == cfs_rq_of(&p->se)->last)) return 1; @@ -9564,13 +9532,13 @@ void __init sched_init(void) current->sched_class = &fair_sched_class; /* Allocate the nohz_cpu_mask if CONFIG_CPUMASK_OFFSTACK */ - zalloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT); + alloc_cpumask_var(&nohz_cpu_mask, GFP_NOWAIT); #ifdef CONFIG_SMP #ifdef CONFIG_NO_HZ - zalloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT); + alloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT); alloc_cpumask_var(&nohz.ilb_grp_nohz_mask, GFP_NOWAIT); #endif - zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT); + alloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT); #endif /* SMP */ perf_event_init(); diff --git a/trunk/kernel/sched_fair.c b/trunk/kernel/sched_fair.c index 37087a7fac22..c32c3e643daa 100644 --- a/trunk/kernel/sched_fair.c +++ b/trunk/kernel/sched_fair.c @@ -822,26 +822,6 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) * re-elected due to buddy favours. */ clear_buddies(cfs_rq, curr); - return; - } - - /* - * Ensure that a task that missed wakeup preemption by a - * narrow margin doesn't have to wait for a full slice. - * This also mitigates buddy induced latencies under load. - */ - if (!sched_feat(WAKEUP_PREEMPT)) - return; - - if (delta_exec < sysctl_sched_min_granularity) - return; - - if (cfs_rq->nr_running > 1) { - struct sched_entity *se = __pick_next_entity(cfs_rq); - s64 delta = curr->vruntime - se->vruntime; - - if (delta > ideal_runtime) - resched_task(rq_of(cfs_rq)->curr); } } @@ -881,18 +861,21 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se); static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq) { struct sched_entity *se = __pick_next_entity(cfs_rq); - struct sched_entity *left = se; + struct sched_entity *buddy; - if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) - se = cfs_rq->next; - - /* - * Prefer last buddy, try to return the CPU to a preempted task. - */ - if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, left) < 1) - se = cfs_rq->last; + if (cfs_rq->next) { + buddy = cfs_rq->next; + cfs_rq->next = NULL; + if (wakeup_preempt_entity(buddy, se) < 1) + return buddy; + } - clear_buddies(cfs_rq, se); + if (cfs_rq->last) { + buddy = cfs_rq->last; + cfs_rq->last = NULL; + if (wakeup_preempt_entity(buddy, se) < 1) + return buddy; + } return se; } @@ -1594,7 +1577,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ struct sched_entity *se = &curr->se, *pse = &p->se; struct cfs_rq *cfs_rq = task_cfs_rq(curr); int sync = wake_flags & WF_SYNC; - int scale = cfs_rq->nr_running >= sched_nr_latency; update_curr(cfs_rq); @@ -1609,7 +1591,18 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ if (unlikely(se == pse)) return; - if (sched_feat(NEXT_BUDDY) && scale && !(wake_flags & WF_FORK)) + /* + * Only set the backward buddy when the current task is still on the + * rq. This can happen when a wakeup gets interleaved with schedule on + * the ->pre_schedule() or idle_balance() point, either of which can + * drop the rq lock. + * + * Also, during early boot the idle thread is in the fair class, for + * obvious reasons its a bad idea to schedule back to the idle thread. + */ + if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle)) + set_last_buddy(se); + if (sched_feat(NEXT_BUDDY) && !(wake_flags & WF_FORK)) set_next_buddy(pse); /* @@ -1655,22 +1648,8 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ BUG_ON(!pse); - if (wakeup_preempt_entity(se, pse) == 1) { + if (wakeup_preempt_entity(se, pse) == 1) resched_task(curr); - /* - * Only set the backward buddy when the current task is still - * on the rq. This can happen when a wakeup gets interleaved - * with schedule on the ->pre_schedule() or idle_balance() - * point, either of which can * drop the rq lock. - * - * Also, during early boot the idle thread is in the fair class, - * for obvious reasons its a bad idea to schedule back to it. - */ - if (unlikely(!se->on_rq || curr == rq->idle)) - return; - if (sched_feat(LAST_BUDDY) && scale && entity_is_task(se)) - set_last_buddy(se); - } } static struct task_struct *pick_next_task_fair(struct rq *rq) diff --git a/trunk/kernel/trace/ftrace.c b/trunk/kernel/trace/ftrace.c index 6dc4e5ef7a01..9c451a1930b6 100644 --- a/trunk/kernel/trace/ftrace.c +++ b/trunk/kernel/trace/ftrace.c @@ -2222,15 +2222,15 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, ret = ftrace_process_regex(parser->buffer, parser->idx, enable); if (ret) - goto out_unlock; + goto out; trace_parser_clear(parser); } ret = read; -out_unlock: - mutex_unlock(&ftrace_regex_lock); + mutex_unlock(&ftrace_regex_lock); +out: return ret; } diff --git a/trunk/kernel/trace/ring_buffer.c b/trunk/kernel/trace/ring_buffer.c index 5dd017fea6f5..3ffa502fb243 100644 --- a/trunk/kernel/trace/ring_buffer.c +++ b/trunk/kernel/trace/ring_buffer.c @@ -1193,7 +1193,6 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned nr_pages) atomic_inc(&cpu_buffer->record_disabled); synchronize_sched(); - spin_lock_irq(&cpu_buffer->reader_lock); rb_head_page_deactivate(cpu_buffer); for (i = 0; i < nr_pages; i++) { @@ -1208,7 +1207,6 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned nr_pages) return; rb_reset_cpu(cpu_buffer); - spin_unlock_irq(&cpu_buffer->reader_lock); rb_check_pages(cpu_buffer); diff --git a/trunk/lib/dma-debug.c b/trunk/lib/dma-debug.c index ce6b7eabf674..58a9f9fc609a 100644 --- a/trunk/lib/dma-debug.c +++ b/trunk/lib/dma-debug.c @@ -819,11 +819,9 @@ static void check_unmap(struct dma_debug_entry *ref) err_printk(ref->dev, entry, "DMA-API: device driver frees " "DMA memory with different CPU address " "[device address=0x%016llx] [size=%llu bytes] " - "[cpu alloc address=0x%016llx] " - "[cpu free address=0x%016llx]", + "[cpu alloc address=%p] [cpu free address=%p]", ref->dev_addr, ref->size, - (unsigned long long)entry->paddr, - (unsigned long long)ref->paddr); + (void *)entry->paddr, (void *)ref->paddr); } if (ref->sg_call_ents && ref->type == dma_debug_sg &&