diff --git a/[refs] b/[refs] index d6471469026d..d10ef9f26916 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 65fd21058a791f35aff11eeccd2e270f0faf11ec +refs/heads/master: 9c88b06dc7589fb0bccd617c4659066fb803cfda diff --git a/trunk/Documentation/filesystems/Locking b/trunk/Documentation/filesystems/Locking index 3120f8dd2c31..76efe5b71d7d 100644 --- a/trunk/Documentation/filesystems/Locking +++ b/trunk/Documentation/filesystems/Locking @@ -512,24 +512,16 @@ locking rules: BKL mmap_sem PageLocked(page) open: no yes close: no yes -fault: no yes can return with page locked -page_mkwrite: no yes can return with page locked +fault: no yes +page_mkwrite: no yes no access: no yes - ->fault() is called when a previously not present pte is about -to be faulted in. The filesystem must find and return the page associated -with the passed in "pgoff" in the vm_fault structure. If it is possible that -the page may be truncated and/or invalidated, then the filesystem must lock -the page, then ensure it is not already truncated (the page lock will block -subsequent truncate), and then return with VM_FAULT_LOCKED, and the page -locked. The VM will unlock the page. - - ->page_mkwrite() is called when a previously read-only pte is -about to become writeable. The filesystem again must ensure that there are -no truncate/invalidate races, and then return with the page locked. If -the page has been truncated, the filesystem should not look up a new page -like the ->fault() handler, but simply return with VM_FAULT_NOPAGE, which -will cause the VM to retry the fault. + ->page_mkwrite() is called when a previously read-only page is +about to become writeable. The file system is responsible for +protecting against truncate races. Once appropriate action has been +taking to lock out truncate, the page range should be verified to be +within i_size. The page mapping should also be checked that it is not +NULL. ->access() is called when get_user_pages() fails in acces_process_vm(), typically used to debug a process through diff --git a/trunk/Documentation/kernel-doc-nano-HOWTO.txt b/trunk/Documentation/kernel-doc-nano-HOWTO.txt index 4d04572b6549..026ec7d57384 100644 --- a/trunk/Documentation/kernel-doc-nano-HOWTO.txt +++ b/trunk/Documentation/kernel-doc-nano-HOWTO.txt @@ -269,10 +269,7 @@ Use the argument mechanism to document members or constants. Inside a struct description, you can use the "private:" and "public:" comment tags. Structure fields that are inside a "private:" area -are not listed in the generated output documentation. The "private:" -and "public:" tags must begin immediately following a "/*" comment -marker. They may optionally include comments between the ":" and the -ending "*/" marker. +are not listed in the generated output documentation. Example: @@ -286,7 +283,7 @@ Example: struct my_struct { int a; int b; -/* private: internal use only */ +/* private: */ int c; }; diff --git a/trunk/Documentation/sysctl/vm.txt b/trunk/Documentation/sysctl/vm.txt index b716d33912d8..97c4b3284329 100644 --- a/trunk/Documentation/sysctl/vm.txt +++ b/trunk/Documentation/sysctl/vm.txt @@ -90,10 +90,6 @@ will itself start writeback. If dirty_bytes is written, dirty_ratio becomes a function of its value (dirty_bytes / the amount of dirtyable system memory). -Note: the minimum value allowed for dirty_bytes is two pages (in bytes); any -value lower than this limit will be ignored and the old configuration will be -retained. - ============================================================== dirty_expire_centisecs diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 066644a8fbcb..c547f4a2bb62 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -4521,19 +4521,6 @@ M: jim@jtan.com L: cbe-oss-dev@ozlabs.org S: Maintained -PTRACE SUPPORT -P: Roland McGrath -M: roland@redhat.com -P: Oleg Nesterov -M: oleg@redhat.com -L: linux-kernel@vger.kernel.org -S: Maintained -F: include/asm-generic/syscall.h -F: include/linux/ptrace.h -F: include/linux/regset.h -F: include/linux/tracehook.h -F: kernel/ptrace.c - PVRUSB2 VIDEO4LINUX DRIVER P: Mike Isely M: isely@pobox.com @@ -4679,13 +4666,13 @@ F: kernel/rcutorture.c RDC R-321X SoC P: Florian Fainelli -M: florian@openwrt.org +M: florian.fainelli@telecomint.eu L: linux-kernel@vger.kernel.org S: Maintained RDC R6040 FAST ETHERNET DRIVER P: Florian Fainelli -M: florian@openwrt.org +M: florian.fainelli@telecomint.eu L: netdev@vger.kernel.org S: Maintained F: drivers/net/r6040.c diff --git a/trunk/arch/alpha/include/asm/barrier.h b/trunk/arch/alpha/include/asm/barrier.h index ce8860a0b32d..ac78eba909bc 100644 --- a/trunk/arch/alpha/include/asm/barrier.h +++ b/trunk/arch/alpha/include/asm/barrier.h @@ -16,13 +16,11 @@ __asm__ __volatile__("wmb": : :"memory") __asm__ __volatile__("mb": : :"memory") #ifdef CONFIG_SMP -#define __ASM_SMP_MB "\tmb\n" #define smp_mb() mb() #define smp_rmb() rmb() #define smp_wmb() wmb() #define smp_read_barrier_depends() read_barrier_depends() #else -#define __ASM_SMP_MB #define smp_mb() barrier() #define smp_rmb() barrier() #define smp_wmb() barrier() diff --git a/trunk/arch/alpha/include/asm/futex.h b/trunk/arch/alpha/include/asm/futex.h index 945de222ab91..6a332a9f099c 100644 --- a/trunk/arch/alpha/include/asm/futex.h +++ b/trunk/arch/alpha/include/asm/futex.h @@ -1,116 +1,6 @@ -#ifndef _ASM_ALPHA_FUTEX_H -#define _ASM_ALPHA_FUTEX_H +#ifndef _ASM_FUTEX_H +#define _ASM_FUTEX_H -#ifdef __KERNEL__ +#include -#include -#include -#include -#include - -#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ - __asm__ __volatile__( \ - __ASM_SMP_MB \ - "1: ldl_l %0,0(%2)\n" \ - insn \ - "2: stl_c %1,0(%2)\n" \ - " beq %1,4f\n" \ - " mov $31,%1\n" \ - "3: .subsection 2\n" \ - "4: br 1b\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .long 1b-.\n" \ - " lda $31,3b-1b(%1)\n" \ - " .long 2b-.\n" \ - " lda $31,3b-2b(%1)\n" \ - " .previous\n" \ - : "=&r" (oldval), "=&r"(ret) \ - : "r" (uaddr), "r"(oparg) \ - : "memory") - -static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) -{ - int op = (encoded_op >> 28) & 7; - int cmp = (encoded_op >> 24) & 15; - int oparg = (encoded_op << 8) >> 20; - int cmparg = (encoded_op << 20) >> 20; - int oldval = 0, ret; - if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) - oparg = 1 << oparg; - - if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) - return -EFAULT; - - pagefault_disable(); - - switch (op) { - case FUTEX_OP_SET: - __futex_atomic_op("mov %3,%1\n", ret, oldval, uaddr, oparg); - break; - case FUTEX_OP_ADD: - __futex_atomic_op("addl %0,%3,%1\n", ret, oldval, uaddr, oparg); - break; - case FUTEX_OP_OR: - __futex_atomic_op("or %0,%3,%1\n", ret, oldval, uaddr, oparg); - break; - case FUTEX_OP_ANDN: - __futex_atomic_op("andnot %0,%3,%1\n", ret, oldval, uaddr, oparg); - break; - case FUTEX_OP_XOR: - __futex_atomic_op("xor %0,%3,%1\n", ret, oldval, uaddr, oparg); - break; - default: - ret = -ENOSYS; - } - - pagefault_enable(); - - if (!ret) { - switch (cmp) { - case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break; - case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break; - case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break; - case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break; - case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break; - case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break; - default: ret = -ENOSYS; - } - } - return ret; -} - -static inline int -futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) -{ - int prev, cmp; - - if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) - return -EFAULT; - - __asm__ __volatile__ ( - __ASM_SMP_MB - "1: ldl_l %0,0(%2)\n" - " cmpeq %0,%3,%1\n" - " beq %1,3f\n" - " mov %4,%1\n" - "2: stl_c %1,0(%2)\n" - " beq %1,4f\n" - "3: .subsection 2\n" - "4: br 1b\n" - " .previous\n" - " .section __ex_table,\"a\"\n" - " .long 1b-.\n" - " lda $31,3b-1b(%0)\n" - " .long 2b-.\n" - " lda $31,3b-2b(%0)\n" - " .previous\n" - : "=&r"(prev), "=&r"(cmp) - : "r"(uaddr), "r"((long)oldval), "r"(newval) - : "memory"); - - return prev; -} - -#endif /* __KERNEL__ */ -#endif /* _ASM_ALPHA_FUTEX_H */ +#endif diff --git a/trunk/arch/alpha/include/asm/uaccess.h b/trunk/arch/alpha/include/asm/uaccess.h index b49ec2f8d6e3..163f3053001c 100644 --- a/trunk/arch/alpha/include/asm/uaccess.h +++ b/trunk/arch/alpha/include/asm/uaccess.h @@ -507,7 +507,5 @@ struct exception_table_entry (pc) + (_fixup)->fixup.bits.nextinsn; \ }) -#define ARCH_HAS_SORT_EXTABLE -#define ARCH_HAS_SEARCH_EXTABLE #endif /* __ALPHA_UACCESS_H */ diff --git a/trunk/arch/alpha/kernel/Makefile b/trunk/arch/alpha/kernel/Makefile index 7739a62440a7..a427538252f8 100644 --- a/trunk/arch/alpha/kernel/Makefile +++ b/trunk/arch/alpha/kernel/Makefile @@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror -Wno-sign-compare obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ irq_alpha.o signal.o setup.o ptrace.o time.o \ - alpha_ksyms.o systbls.o err_common.o io.o + alpha_ksyms.o systbls.o err_common.o io.o binfmt_loader.o obj-$(CONFIG_VGA_HOSE) += console.o obj-$(CONFIG_SMP) += smp.o @@ -43,10 +43,6 @@ else # Misc support obj-$(CONFIG_ALPHA_SRM) += srmcons.o -ifdef CONFIG_BINFMT_AOUT -obj-y += binfmt_loader.o -endif - # Core logic support obj-$(CONFIG_ALPHA_APECS) += core_apecs.o obj-$(CONFIG_ALPHA_CIA) += core_cia.o diff --git a/trunk/arch/alpha/kernel/binfmt_loader.c b/trunk/arch/alpha/kernel/binfmt_loader.c index 3fcfad410130..4a0af906b00a 100644 --- a/trunk/arch/alpha/kernel/binfmt_loader.c +++ b/trunk/arch/alpha/kernel/binfmt_loader.c @@ -46,6 +46,6 @@ static struct linux_binfmt loader_format = { static int __init init_loader_binfmt(void) { - return insert_binfmt(&loader_format); + return register_binfmt(&loader_format); } arch_initcall(init_loader_binfmt); diff --git a/trunk/arch/alpha/kernel/err_ev6.c b/trunk/arch/alpha/kernel/err_ev6.c index 8ca6345bf131..985e5c1681ac 100644 --- a/trunk/arch/alpha/kernel/err_ev6.c +++ b/trunk/arch/alpha/kernel/err_ev6.c @@ -229,7 +229,7 @@ ev6_process_logout_frame(struct el_common *mchk_header, int print) } void -ev6_machine_check(unsigned long vector, unsigned long la_ptr) +ev6_machine_check(u64 vector, u64 la_ptr) { struct el_common *mchk_header = (struct el_common *)la_ptr; diff --git a/trunk/arch/alpha/kernel/err_ev7.c b/trunk/arch/alpha/kernel/err_ev7.c index d738a67112d4..73770c6ca013 100644 --- a/trunk/arch/alpha/kernel/err_ev7.c +++ b/trunk/arch/alpha/kernel/err_ev7.c @@ -117,7 +117,7 @@ ev7_collect_logout_frame_subpackets(struct el_subpacket *el_ptr, } void -ev7_machine_check(unsigned long vector, unsigned long la_ptr) +ev7_machine_check(u64 vector, u64 la_ptr) { struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr; char *saved_err_prefix = err_print_prefix; @@ -246,7 +246,7 @@ ev7_process_pal_subpacket(struct el_subpacket *header) switch(header->type) { case EL_TYPE__PAL__LOGOUT_FRAME: - printk("%s*** MCHK occurred on LPID %lld (RBOX %llx)\n", + printk("%s*** MCHK occurred on LPID %ld (RBOX %llx)\n", err_print_prefix, packet->by_type.logout.whami, packet->by_type.logout.rbox_whami); diff --git a/trunk/arch/alpha/kernel/err_impl.h b/trunk/arch/alpha/kernel/err_impl.h index 0c010ca4611e..3c12258158e6 100644 --- a/trunk/arch/alpha/kernel/err_impl.h +++ b/trunk/arch/alpha/kernel/err_impl.h @@ -60,26 +60,26 @@ extern struct ev7_lf_subpackets * ev7_collect_logout_frame_subpackets(struct el_subpacket *, struct ev7_lf_subpackets *); extern void ev7_register_error_handlers(void); -extern void ev7_machine_check(unsigned long, unsigned long); +extern void ev7_machine_check(u64, u64); /* * err_ev6.c */ extern void ev6_register_error_handlers(void); extern int ev6_process_logout_frame(struct el_common *, int); -extern void ev6_machine_check(unsigned long, unsigned long); +extern void ev6_machine_check(u64, u64); /* * err_marvel.c */ -extern void marvel_machine_check(unsigned long, unsigned long); +extern void marvel_machine_check(u64, u64); extern void marvel_register_error_handlers(void); /* * err_titan.c */ extern int titan_process_logout_frame(struct el_common *, int); -extern void titan_machine_check(unsigned long, unsigned long); +extern void titan_machine_check(u64, u64); extern void titan_register_error_handlers(void); extern int privateer_process_logout_frame(struct el_common *, int); -extern void privateer_machine_check(unsigned long, unsigned long); +extern void privateer_machine_check(u64, u64); diff --git a/trunk/arch/alpha/kernel/err_marvel.c b/trunk/arch/alpha/kernel/err_marvel.c index 52a79dfc13c6..6bfd243efba3 100644 --- a/trunk/arch/alpha/kernel/err_marvel.c +++ b/trunk/arch/alpha/kernel/err_marvel.c @@ -1042,7 +1042,7 @@ marvel_process_logout_frame(struct ev7_lf_subpackets *lf_subpackets, int print) } void -marvel_machine_check(unsigned long vector, unsigned long la_ptr) +marvel_machine_check(u64 vector, u64 la_ptr) { struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr; int (*process_frame)(struct ev7_lf_subpackets *, int) = NULL; diff --git a/trunk/arch/alpha/kernel/err_titan.c b/trunk/arch/alpha/kernel/err_titan.c index f7ed97ce0dfd..c7e28a88d6e3 100644 --- a/trunk/arch/alpha/kernel/err_titan.c +++ b/trunk/arch/alpha/kernel/err_titan.c @@ -380,7 +380,7 @@ titan_process_logout_frame(struct el_common *mchk_header, int print) } void -titan_machine_check(unsigned long vector, unsigned long la_ptr) +titan_machine_check(u64 vector, u64 la_ptr) { struct el_common *mchk_header = (struct el_common *)la_ptr; struct el_TITAN_sysdata_mcheck *tmchk = @@ -702,7 +702,7 @@ privateer_process_logout_frame(struct el_common *mchk_header, int print) } void -privateer_machine_check(unsigned long vector, unsigned long la_ptr) +privateer_machine_check(u64 vector, u64 la_ptr) { struct el_common *mchk_header = (struct el_common *)la_ptr; struct el_TITAN_sysdata_mcheck *tmchk = diff --git a/trunk/arch/alpha/kernel/proto.h b/trunk/arch/alpha/kernel/proto.h index 3d2627ec9860..567f2598d090 100644 --- a/trunk/arch/alpha/kernel/proto.h +++ b/trunk/arch/alpha/kernel/proto.h @@ -36,6 +36,7 @@ extern void cia_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); extern struct pci_ops irongate_pci_ops; extern int irongate_pci_clr_err(void); extern void irongate_init_arch(void); +extern void irongate_machine_check(u64, u64); #define irongate_pci_tbi ((void *)0) /* core_lca.c */ @@ -48,7 +49,7 @@ extern void lca_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); extern struct pci_ops marvel_pci_ops; extern void marvel_init_arch(void); extern void marvel_kill_arch(int); -extern void marvel_machine_check(unsigned long, unsigned long); +extern void marvel_machine_check(u64, u64); extern void marvel_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); extern int marvel_pa_to_nid(unsigned long); extern int marvel_cpuid_to_nid(int); @@ -85,7 +86,7 @@ extern void t2_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); extern struct pci_ops titan_pci_ops; extern void titan_init_arch(void); extern void titan_kill_arch(int); -extern void titan_machine_check(unsigned long, unsigned long); +extern void titan_machine_check(u64, u64); extern void titan_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); extern struct _alpha_agp_info *titan_agp_info(void); diff --git a/trunk/arch/alpha/mm/extable.c b/trunk/arch/alpha/mm/extable.c index 62dc379d301a..dc7aeda15773 100644 --- a/trunk/arch/alpha/mm/extable.c +++ b/trunk/arch/alpha/mm/extable.c @@ -3,49 +3,11 @@ */ #include -#include #include -static inline unsigned long ex_to_addr(const struct exception_table_entry *x) -{ - return (unsigned long)&x->insn + x->insn; -} - -static void swap_ex(void *a, void *b, int size) -{ - struct exception_table_entry *ex_a = a, *ex_b = b; - unsigned long addr_a = ex_to_addr(ex_a), addr_b = ex_to_addr(ex_b); - unsigned int t = ex_a->fixup.unit; - - ex_a->fixup.unit = ex_b->fixup.unit; - ex_b->fixup.unit = t; - ex_a->insn = (int)(addr_b - (unsigned long)&ex_a->insn); - ex_b->insn = (int)(addr_a - (unsigned long)&ex_b->insn); -} - -/* - * The exception table needs to be sorted so that the binary - * search that we use to find entries in it works properly. - * This is used both for the kernel exception table and for - * the exception tables of modules that get loaded. - */ -static int cmp_ex(const void *a, const void *b) -{ - const struct exception_table_entry *x = a, *y = b; - - /* avoid overflow */ - if (ex_to_addr(x) > ex_to_addr(y)) - return 1; - if (ex_to_addr(x) < ex_to_addr(y)) - return -1; - return 0; -} - void sort_extable(struct exception_table_entry *start, struct exception_table_entry *finish) { - sort(start, finish - start, sizeof(struct exception_table_entry), - cmp_ex, swap_ex); } const struct exception_table_entry * @@ -58,7 +20,7 @@ search_extable(const struct exception_table_entry *first, unsigned long mid_value; mid = (last - first) / 2 + first; - mid_value = ex_to_addr(mid); + mid_value = (unsigned long)&mid->insn + mid->insn; if (mid_value == value) return mid; else if (mid_value < value) diff --git a/trunk/arch/m32r/boot/compressed/Makefile b/trunk/arch/m32r/boot/compressed/Makefile index d908e1d3c07f..560484ae35ec 100644 --- a/trunk/arch/m32r/boot/compressed/Makefile +++ b/trunk/arch/m32r/boot/compressed/Makefile @@ -6,7 +6,6 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \ piggy.o vmlinux.lds -EXTRA_AFLAGS := -traditional OBJECTS = $(obj)/head.o $(obj)/misc.o diff --git a/trunk/arch/m32r/kernel/Makefile b/trunk/arch/m32r/kernel/Makefile index 09200d4886e3..b1a4b6036591 100644 --- a/trunk/arch/m32r/kernel/Makefile +++ b/trunk/arch/m32r/kernel/Makefile @@ -9,5 +9,3 @@ obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \ obj-$(CONFIG_SMP) += smp.o smpboot.o obj-$(CONFIG_MODULES) += module.o - -EXTRA_AFLAGS := -traditional diff --git a/trunk/arch/microblaze/include/asm/of_platform.h b/trunk/arch/microblaze/include/asm/of_platform.h index 37491276c6ca..187c0eedaece 100644 --- a/trunk/arch/microblaze/include/asm/of_platform.h +++ b/trunk/arch/microblaze/include/asm/of_platform.h @@ -36,6 +36,16 @@ static const struct of_device_id of_default_bus_ids[] = { {}, }; +/* Platform drivers register/unregister */ +static inline int of_register_platform_driver(struct of_platform_driver *drv) +{ + return of_register_driver(drv, &of_platform_bus_type); +} +static inline void of_unregister_platform_driver(struct of_platform_driver *drv) +{ + of_unregister_driver(drv); +} + /* Platform devices and busses creation */ extern struct of_device *of_platform_device_create(struct device_node *np, const char *bus_id, diff --git a/trunk/arch/powerpc/include/asm/of_platform.h b/trunk/arch/powerpc/include/asm/of_platform.h index d4aaa3489440..53b46507ffde 100644 --- a/trunk/arch/powerpc/include/asm/of_platform.h +++ b/trunk/arch/powerpc/include/asm/of_platform.h @@ -11,6 +11,16 @@ * */ +/* Platform drivers register/unregister */ +static inline int of_register_platform_driver(struct of_platform_driver *drv) +{ + return of_register_driver(drv, &of_platform_bus_type); +} +static inline void of_unregister_platform_driver(struct of_platform_driver *drv) +{ + of_unregister_driver(drv); +} + /* Platform devices and busses creation */ extern struct of_device *of_platform_device_create(struct device_node *np, const char *bus_id, diff --git a/trunk/drivers/acpi/acpica/rscalc.c b/trunk/drivers/acpi/acpica/rscalc.c index 88b5a2c4814d..b6667ff059e5 100644 --- a/trunk/drivers/acpi/acpica/rscalc.c +++ b/trunk/drivers/acpi/acpica/rscalc.c @@ -543,13 +543,6 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, package_element = *top_object_list; - /* We must have a valid Package object */ - - if (!package_element || - (package_element->common.type != ACPI_TYPE_PACKAGE)) { - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - /* * The sub_object_list will now point to an array of the * four IRQ elements: Address, Pin, Source and source_index diff --git a/trunk/drivers/firmware/iscsi_ibft.c b/trunk/drivers/firmware/iscsi_ibft.c index 420a96e7f2db..7b7ddc2d51c9 100644 --- a/trunk/drivers/firmware/iscsi_ibft.c +++ b/trunk/drivers/firmware/iscsi_ibft.c @@ -754,11 +754,11 @@ static int __init ibft_check_nic_for(struct ibft_nic *nic, int entry) rc = 1; break; case ibft_eth_ip_addr: - if (memcmp(nic->ip_addr, nulls, sizeof(nic->ip_addr))) + if (!memcmp(nic->dhcp, nulls, sizeof(nic->dhcp))) rc = 1; break; case ibft_eth_subnet_mask: - if (nic->subnet_mask_prefix) + if (!memcmp(nic->dhcp, nulls, sizeof(nic->dhcp))) rc = 1; break; case ibft_eth_origin: diff --git a/trunk/drivers/serial/crisv10.c b/trunk/drivers/serial/crisv10.c index 7be52fe288eb..7ba7d70f04d6 100644 --- a/trunk/drivers/serial/crisv10.c +++ b/trunk/drivers/serial/crisv10.c @@ -23,18 +23,16 @@ static char *serial_version = "$Revision: 1.25 $"; #include #include #include +#include #include #include #include -#include -#include -#include -#include -#include +#include #include #include #include +#include #include @@ -458,6 +456,7 @@ static struct e100_serial rs_table[] = { #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) +static struct ktermios *serial_termios[NR_PORTS]; #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER static struct fast_timer fast_timers[NR_PORTS]; #endif @@ -4258,132 +4257,151 @@ rs_open(struct tty_struct *tty, struct file * filp) return 0; } -#ifdef CONFIG_PROC_FS /* * /proc fs routines.... */ -static void seq_line_info(struct seq_file *m, struct e100_serial *info) +static int line_info(char *buf, struct e100_serial *info) { + char stat_buf[30]; + int ret; unsigned long tmp; - seq_printf(m, "%d: uart:E100 port:%lX irq:%d", - info->line, (unsigned long)info->ioport, info->irq); + ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d", + info->line, (unsigned long)info->ioport, info->irq); if (!info->ioport || (info->type == PORT_UNKNOWN)) { - seq_printf(m, "\n"); - return; + ret += sprintf(buf+ret, "\n"); + return ret; } - seq_printf(m, " baud:%d", info->baud); - seq_printf(m, " tx:%lu rx:%lu", + stat_buf[0] = 0; + stat_buf[1] = 0; + if (!E100_RTS_GET(info)) + strcat(stat_buf, "|RTS"); + if (!E100_CTS_GET(info)) + strcat(stat_buf, "|CTS"); + if (!E100_DTR_GET(info)) + strcat(stat_buf, "|DTR"); + if (!E100_DSR_GET(info)) + strcat(stat_buf, "|DSR"); + if (!E100_CD_GET(info)) + strcat(stat_buf, "|CD"); + if (!E100_RI_GET(info)) + strcat(stat_buf, "|RI"); + + ret += sprintf(buf+ret, " baud:%d", info->baud); + + ret += sprintf(buf+ret, " tx:%lu rx:%lu", (unsigned long)info->icount.tx, (unsigned long)info->icount.rx); tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); - if (tmp) - seq_printf(m, " tx_pend:%lu/%lu", - (unsigned long)tmp, - (unsigned long)SERIAL_XMIT_SIZE); + if (tmp) { + ret += sprintf(buf+ret, " tx_pend:%lu/%lu", + (unsigned long)tmp, + (unsigned long)SERIAL_XMIT_SIZE); + } - seq_printf(m, " rx_pend:%lu/%lu", - (unsigned long)info->recv_cnt, - (unsigned long)info->max_recv_cnt); + ret += sprintf(buf+ret, " rx_pend:%lu/%lu", + (unsigned long)info->recv_cnt, + (unsigned long)info->max_recv_cnt); #if 1 if (info->port.tty) { + if (info->port.tty->stopped) - seq_printf(m, " stopped:%i", - (int)info->port.tty->stopped); + ret += sprintf(buf+ret, " stopped:%i", + (int)info->port.tty->stopped); if (info->port.tty->hw_stopped) - seq_printf(m, " hw_stopped:%i", - (int)info->port.tty->hw_stopped); + ret += sprintf(buf+ret, " hw_stopped:%i", + (int)info->port.tty->hw_stopped); } { unsigned char rstat = info->ioport[REG_STATUS]; - if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect)) - seq_printf(m, " xoff_detect:1"); + if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) + ret += sprintf(buf+ret, " xoff_detect:1"); } #endif + + + if (info->icount.frame) - seq_printf(m, " fe:%lu", (unsigned long)info->icount.frame); + ret += sprintf(buf+ret, " fe:%lu", + (unsigned long)info->icount.frame); if (info->icount.parity) - seq_printf(m, " pe:%lu", (unsigned long)info->icount.parity); + ret += sprintf(buf+ret, " pe:%lu", + (unsigned long)info->icount.parity); if (info->icount.brk) - seq_printf(m, " brk:%lu", (unsigned long)info->icount.brk); + ret += sprintf(buf+ret, " brk:%lu", + (unsigned long)info->icount.brk); if (info->icount.overrun) - seq_printf(m, " oe:%lu", (unsigned long)info->icount.overrun); + ret += sprintf(buf+ret, " oe:%lu", + (unsigned long)info->icount.overrun); /* * Last thing is the RS-232 status lines */ - if (!E100_RTS_GET(info)) - seq_puts(m, "|RTS"); - if (!E100_CTS_GET(info)) - seq_puts(m, "|CTS"); - if (!E100_DTR_GET(info)) - seq_puts(m, "|DTR"); - if (!E100_DSR_GET(info)) - seq_puts(m, "|DSR"); - if (!E100_CD_GET(info)) - seq_puts(m, "|CD"); - if (!E100_RI_GET(info)) - seq_puts(m, "|RI"); - seq_puts(m, "\n"); + ret += sprintf(buf+ret, " %s\n", stat_buf+1); + return ret; } - -static int crisv10_proc_show(struct seq_file *m, void *v) +int rs_read_proc(char *page, char **start, off_t off, int count, + int *eof, void *data) { - int i; + int i, len = 0, l; + off_t begin = 0; - seq_printf(m, "serinfo:1.0 driver:%s\n", serial_version); - - for (i = 0; i < NR_PORTS; i++) { + len += sprintf(page, "serinfo:1.0 driver:%s\n", + serial_version); + for (i = 0; i < NR_PORTS && len < 4000; i++) { if (!rs_table[i].enabled) continue; - seq_line_info(m, &rs_table[i]); + l = line_info(page + len, &rs_table[i]); + len += l; + if (len+begin > off+count) + goto done; + if (len+begin < off) { + begin += len; + len = 0; + } } #ifdef DEBUG_LOG_INCLUDED for (i = 0; i < debug_log_pos; i++) { - seq_printf(m, "%-4i %lu.%lu ", - i, debug_log[i].time, - timer_data_to_ns(debug_log[i].timer_data)); - seq_printf(m, debug_log[i].string, debug_log[i].value); + len += sprintf(page + len, "%-4i %lu.%lu ", i, debug_log[i].time, timer_data_to_ns(debug_log[i].timer_data)); + len += sprintf(page + len, debug_log[i].string, debug_log[i].value); + if (len+begin > off+count) + goto done; + if (len+begin < off) { + begin += len; + len = 0; + } } - seq_printf(m, "debug_log %i/%i\n", i, DEBUG_LOG_SIZE); + len += sprintf(page + len, "debug_log %i/%i %li bytes\n", + i, DEBUG_LOG_SIZE, begin+len); debug_log_pos = 0; #endif - return 0; -} -static int crisv10_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, crisv10_proc_show, NULL); + *eof = 1; +done: + if (off >= len+begin) + return 0; + *start = page + (off-begin); + return ((count < begin+len-off) ? count : begin+len-off); } -static const struct file_operations crisv10_proc_fops = { - .owner = THIS_MODULE, - .open = crisv10_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; -#endif - - /* Finally, routines used to initialize the serial driver. */ -static void show_serial_version(void) +static void +show_serial_version(void) { printk(KERN_INFO - "ETRAX 100LX serial-driver %s, " - "(c) 2000-2004 Axis Communications AB\r\n", + "ETRAX 100LX serial-driver %s, (c) 2000-2004 Axis Communications AB\r\n", &serial_version[11]); /* "$Revision: x.yy" */ } @@ -4407,14 +4425,13 @@ static const struct tty_operations rs_ops = { .break_ctl = rs_break, .send_xchar = rs_send_xchar, .wait_until_sent = rs_wait_until_sent, + .read_proc = rs_read_proc, .tiocmget = rs_tiocmget, - .tiocmset = rs_tiocmset, -#ifdef CONFIG_PROC_FS - .proc_fops = &crisv10_proc_fops, -#endif + .tiocmset = rs_tiocmset }; -static int __init rs_init(void) +static int __init +rs_init(void) { int i; struct e100_serial *info; diff --git a/trunk/drivers/video/console/vgacon.c b/trunk/drivers/video/console/vgacon.c index 38e86b84dce0..d012edda6d11 100644 --- a/trunk/drivers/video/console/vgacon.c +++ b/trunk/drivers/video/console/vgacon.c @@ -1282,7 +1282,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font) font->charcount = vga_512_chars ? 512 : 256; if (!font->data) return 0; - return vgacon_do_font_op(&state, font->data, 0, vga_512_chars); + return vgacon_do_font_op(&state, font->data, 0, 0); } #else diff --git a/trunk/fs/autofs4/expire.c b/trunk/fs/autofs4/expire.c index 3077d8f16523..75f7ddacf7d6 100644 --- a/trunk/fs/autofs4/expire.c +++ b/trunk/fs/autofs4/expire.c @@ -70,10 +70,8 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) * Otherwise it's an offset mount and we need to check * if we can umount its mount, if there is one. */ - if (!d_mountpoint(dentry)) { - status = 0; + if (!d_mountpoint(dentry)) goto done; - } } /* Update the expiry counter if fs is busy */ diff --git a/trunk/fs/binfmt_elf_fdpic.c b/trunk/fs/binfmt_elf_fdpic.c index fdb66faa24f1..70cfc4b84ae0 100644 --- a/trunk/fs/binfmt_elf_fdpic.c +++ b/trunk/fs/binfmt_elf_fdpic.c @@ -1388,7 +1388,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus, prstatus->pr_sigpend = p->pending.signal.sig[0]; prstatus->pr_sighold = p->blocked.sig[0]; prstatus->pr_pid = task_pid_vnr(p); - prstatus->pr_ppid = task_pid_vnr(p->real_parent); + prstatus->pr_ppid = task_pid_vnr(p->parent); prstatus->pr_pgrp = task_pgrp_vnr(p); prstatus->pr_sid = task_session_vnr(p); if (thread_group_leader(p)) { @@ -1433,7 +1433,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, psinfo->pr_psargs[len] = 0; psinfo->pr_pid = task_pid_vnr(p); - psinfo->pr_ppid = task_pid_vnr(p->real_parent); + psinfo->pr_ppid = task_pid_vnr(p->parent); psinfo->pr_pgrp = task_pgrp_vnr(p); psinfo->pr_sid = task_session_vnr(p); diff --git a/trunk/fs/buffer.c b/trunk/fs/buffer.c index aed297739eb0..b3e5be7514f5 100644 --- a/trunk/fs/buffer.c +++ b/trunk/fs/buffer.c @@ -2397,8 +2397,7 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, if ((page->mapping != inode->i_mapping) || (page_offset(page) > size)) { /* page got truncated out from underneath us */ - unlock_page(page); - goto out; + goto out_unlock; } /* page is wholly or partially inside EOF */ @@ -2412,15 +2411,14 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, ret = block_commit_write(page, 0, end); if (unlikely(ret)) { - unlock_page(page); if (ret == -ENOMEM) ret = VM_FAULT_OOM; else /* -ENOSPC, -EIO, etc */ ret = VM_FAULT_SIGBUS; - } else - ret = VM_FAULT_LOCKED; + } -out: +out_unlock: + unlock_page(page); return ret; } diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index 639177b0eeac..a3a8ce83940f 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -69,18 +69,17 @@ int suid_dumpable = 0; static LIST_HEAD(formats); static DEFINE_RWLOCK(binfmt_lock); -int __register_binfmt(struct linux_binfmt * fmt, int insert) +int register_binfmt(struct linux_binfmt * fmt) { if (!fmt) return -EINVAL; write_lock(&binfmt_lock); - insert ? list_add(&fmt->lh, &formats) : - list_add_tail(&fmt->lh, &formats); + list_add(&fmt->lh, &formats); write_unlock(&binfmt_lock); return 0; } -EXPORT_SYMBOL(__register_binfmt); +EXPORT_SYMBOL(register_binfmt); void unregister_binfmt(struct linux_binfmt * fmt) { diff --git a/trunk/fs/proc/meminfo.c b/trunk/fs/proc/meminfo.c index c6b0302af4c4..74ea974f5ca6 100644 --- a/trunk/fs/proc/meminfo.c +++ b/trunk/fs/proc/meminfo.c @@ -35,7 +35,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) #define K(x) ((x) << (PAGE_SHIFT - 10)) si_meminfo(&i); si_swapinfo(&i); - committed = percpu_counter_read_positive(&vm_committed_as); + committed = atomic_long_read(&vm_committed_space); allowed = ((totalram_pages - hugetlb_total_pages()) * sysctl_overcommit_ratio / 100) + total_swap_pages; diff --git a/trunk/fs/proc/task_mmu.c b/trunk/fs/proc/task_mmu.c index 6f61b7cc32e0..39e4ad4f59f4 100644 --- a/trunk/fs/proc/task_mmu.c +++ b/trunk/fs/proc/task_mmu.c @@ -665,10 +665,6 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, goto out_task; ret = 0; - - if (!count) - goto out_task; - mm = get_task_mm(task); if (!mm) goto out_task; diff --git a/trunk/include/asm-generic/atomic.h b/trunk/include/asm-generic/atomic.h index 3673a13b6703..7abdaa91ccd3 100644 --- a/trunk/include/asm-generic/atomic.h +++ b/trunk/include/asm-generic/atomic.h @@ -132,9 +132,9 @@ static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u) #define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l)) #define atomic_long_cmpxchg(l, old, new) \ - (atomic64_cmpxchg((atomic64_t *)(l), (old), (new))) + (atomic_cmpxchg((atomic64_t *)(l), (old), (new))) #define atomic_long_xchg(v, new) \ - (atomic64_xchg((atomic64_t *)(l), (new))) + (atomic_xchg((atomic64_t *)(l), (new))) #else /* BITS_PER_LONG == 64 */ diff --git a/trunk/include/linux/binfmts.h b/trunk/include/linux/binfmts.h index 61ee18c1bdb4..6638b8148de7 100644 --- a/trunk/include/linux/binfmts.h +++ b/trunk/include/linux/binfmts.h @@ -82,19 +82,7 @@ struct linux_binfmt { int hasvdso; }; -extern int __register_binfmt(struct linux_binfmt *fmt, int insert); - -/* Registration of default binfmt handlers */ -static inline int register_binfmt(struct linux_binfmt *fmt) -{ - return __register_binfmt(fmt, 0); -} -/* Same as above, but adds a new binfmt at the top of the list */ -static inline int insert_binfmt(struct linux_binfmt *fmt) -{ - return __register_binfmt(fmt, 1); -} - +extern int register_binfmt(struct linux_binfmt *); extern void unregister_binfmt(struct linux_binfmt *); extern int prepare_binprm(struct linux_binprm *); diff --git a/trunk/include/linux/memcontrol.h b/trunk/include/linux/memcontrol.h index 25b9ca93d232..a9e3b76aa884 100644 --- a/trunk/include/linux/memcontrol.h +++ b/trunk/include/linux/memcontrol.h @@ -56,7 +56,7 @@ extern void mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to); extern void mem_cgroup_uncharge_page(struct page *page); extern void mem_cgroup_uncharge_cache_page(struct page *page); -extern int mem_cgroup_shmem_charge_fallback(struct page *page, +extern int mem_cgroup_shrink_usage(struct page *page, struct mm_struct *mm, gfp_t gfp_mask); extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, @@ -155,7 +155,7 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page) { } -static inline int mem_cgroup_shmem_charge_fallback(struct page *page, +static inline int mem_cgroup_shrink_usage(struct page *page, struct mm_struct *mm, gfp_t gfp_mask) { return 0; diff --git a/trunk/include/linux/mman.h b/trunk/include/linux/mman.h index 9872d6ca58ae..30d1073bac3b 100644 --- a/trunk/include/linux/mman.h +++ b/trunk/include/linux/mman.h @@ -12,18 +12,21 @@ #ifdef __KERNEL__ #include -#include #include extern int sysctl_overcommit_memory; extern int sysctl_overcommit_ratio; -extern struct percpu_counter vm_committed_as; +extern atomic_long_t vm_committed_space; +#ifdef CONFIG_SMP +extern void vm_acct_memory(long pages); +#else static inline void vm_acct_memory(long pages) { - percpu_counter_add(&vm_committed_as, pages); + atomic_long_add(pages, &vm_committed_space); } +#endif static inline void vm_unacct_memory(long pages) { diff --git a/trunk/include/linux/of_platform.h b/trunk/include/linux/of_platform.h index 908406651330..3d327b67d7e2 100644 --- a/trunk/include/linux/of_platform.h +++ b/trunk/include/linux/of_platform.h @@ -51,16 +51,6 @@ extern int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus); extern void of_unregister_driver(struct of_platform_driver *drv); -/* Platform drivers register/unregister */ -static inline int of_register_platform_driver(struct of_platform_driver *drv) -{ - return of_register_driver(drv, &of_platform_bus_type); -} -static inline void of_unregister_platform_driver(struct of_platform_driver *drv) -{ - of_unregister_driver(drv); -} - #include extern struct of_device *of_find_device_by_node(struct device_node *np); diff --git a/trunk/kernel/sysctl.c b/trunk/kernel/sysctl.c index ea78fa101ad6..e3d2c7dd59b9 100644 --- a/trunk/kernel/sysctl.c +++ b/trunk/kernel/sysctl.c @@ -103,9 +103,6 @@ static unsigned long one_ul = 1; static int one_hundred = 100; static int one_thousand = 1000; -/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ -static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; - /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ static int maxolduid = 65535; static int minolduid; @@ -1009,7 +1006,7 @@ static struct ctl_table vm_table[] = { .mode = 0644, .proc_handler = &dirty_bytes_handler, .strategy = &sysctl_intvec, - .extra1 = &dirty_bytes_min, + .extra1 = &one_ul, }, { .procname = "dirty_writeback_centisecs", diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index 01c2d8f14685..e44fb0fbb80e 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -1024,7 +1024,9 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page) return NULL; pc = lookup_page_cgroup(page); - lock_page_cgroup(pc); + /* + * Used bit of swapcache is solid under page lock. + */ if (PageCgroupUsed(pc)) { mem = pc->mem_cgroup; if (mem && !css_tryget(&mem->css)) @@ -1038,7 +1040,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page) mem = NULL; rcu_read_unlock(); } - unlock_page_cgroup(pc); return mem; } @@ -1617,28 +1618,37 @@ void mem_cgroup_end_migration(struct mem_cgroup *mem, } /* - * A call to try to shrink memory usage on charge failure at shmem's swapin. - * Calling hierarchical_reclaim is not enough because we should update - * last_oom_jiffies to prevent pagefault_out_of_memory from invoking global OOM. - * Moreover considering hierarchy, we should reclaim from the mem_over_limit, - * not from the memcg which this page would be charged to. - * try_charge_swapin does all of these works properly. + * A call to try to shrink memory usage under specified resource controller. + * This is typically used for page reclaiming for shmem for reducing side + * effect of page allocation from shmem, which is used by some mem_cgroup. */ -int mem_cgroup_shmem_charge_fallback(struct page *page, +int mem_cgroup_shrink_usage(struct page *page, struct mm_struct *mm, gfp_t gfp_mask) { struct mem_cgroup *mem = NULL; - int ret; + int progress = 0; + int retry = MEM_CGROUP_RECLAIM_RETRIES; if (mem_cgroup_disabled()) return 0; + if (page) + mem = try_get_mem_cgroup_from_swapcache(page); + if (!mem && mm) + mem = try_get_mem_cgroup_from_mm(mm); + if (unlikely(!mem)) + return 0; - ret = mem_cgroup_try_charge_swapin(mm, page, gfp_mask, &mem); - if (!ret) - mem_cgroup_cancel_charge_swapin(mem); /* it does !mem check */ + do { + progress = mem_cgroup_hierarchical_reclaim(mem, + gfp_mask, true, false); + progress += mem_cgroup_check_under_limit(mem); + } while (!progress && --retry); - return ret; + css_put(&mem->css); + if (!retry) + return -ENOMEM; + return 0; } static DEFINE_MUTEX(set_limit_mutex); diff --git a/trunk/mm/memory.c b/trunk/mm/memory.c index 4126dd16778c..cf6873e91c6a 100644 --- a/trunk/mm/memory.c +++ b/trunk/mm/memory.c @@ -1971,15 +1971,6 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, ret = tmp; goto unwritable_page; } - if (unlikely(!(tmp & VM_FAULT_LOCKED))) { - lock_page(old_page); - if (!old_page->mapping) { - ret = 0; /* retry the fault */ - unlock_page(old_page); - goto unwritable_page; - } - } else - VM_BUG_ON(!PageLocked(old_page)); /* * Since we dropped the lock we need to revalidate @@ -1989,11 +1980,9 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, */ page_table = pte_offset_map_lock(mm, pmd, address, &ptl); - if (!pte_same(*page_table, orig_pte)) { - unlock_page(old_page); - page_cache_release(old_page); + page_cache_release(old_page); + if (!pte_same(*page_table, orig_pte)) goto unlock; - } page_mkwrite = 1; } @@ -2105,6 +2094,9 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, unlock: pte_unmap_unlock(page_table, ptl); if (dirty_page) { + if (vma->vm_file) + file_update_time(vma->vm_file); + /* * Yes, Virginia, this is actually required to prevent a race * with clear_page_dirty_for_io() from clearing the page dirty @@ -2113,41 +2105,16 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, * * do_no_page is protected similarly. */ - if (!page_mkwrite) { - wait_on_page_locked(dirty_page); - set_page_dirty_balance(dirty_page, page_mkwrite); - } + wait_on_page_locked(dirty_page); + set_page_dirty_balance(dirty_page, page_mkwrite); put_page(dirty_page); - if (page_mkwrite) { - struct address_space *mapping = dirty_page->mapping; - - set_page_dirty(dirty_page); - unlock_page(dirty_page); - page_cache_release(dirty_page); - if (mapping) { - /* - * Some device drivers do not set page.mapping - * but still dirty their pages - */ - balance_dirty_pages_ratelimited(mapping); - } - } - - /* file_update_time outside page_lock */ - if (vma->vm_file) - file_update_time(vma->vm_file); } return ret; oom_free_new: page_cache_release(new_page); oom: - if (old_page) { - if (page_mkwrite) { - unlock_page(old_page); - page_cache_release(old_page); - } + if (old_page) page_cache_release(old_page); - } return VM_FAULT_OOM; unwritable_page: @@ -2491,7 +2458,8 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, if (mem_cgroup_try_charge_swapin(mm, page, GFP_KERNEL, &ptr)) { ret = VM_FAULT_OOM; - goto out_page; + unlock_page(page); + goto out; } /* @@ -2553,7 +2521,6 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, out_nomap: mem_cgroup_cancel_charge_swapin(ptr); pte_unmap_unlock(page_table, ptl); -out_page: unlock_page(page); page_cache_release(page); return ret; @@ -2697,22 +2664,27 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, int tmp; unlock_page(page); - vmf.flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE; + vmf.flags |= FAULT_FLAG_MKWRITE; tmp = vma->vm_ops->page_mkwrite(vma, &vmf); if (unlikely(tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) { ret = tmp; - goto unwritable_page; + anon = 1; /* no anon but release vmf.page */ + goto out_unlocked; + } + lock_page(page); + /* + * XXX: this is not quite right (racy vs + * invalidate) to unlock and relock the page + * like this, however a better fix requires + * reworking page_mkwrite locking API, which + * is better done later. + */ + if (!page->mapping) { + ret = 0; + anon = 1; /* no anon but release vmf.page */ + goto out; } - if (unlikely(!(tmp & VM_FAULT_LOCKED))) { - lock_page(page); - if (!page->mapping) { - ret = 0; /* retry the fault */ - unlock_page(page); - goto unwritable_page; - } - } else - VM_BUG_ON(!PageLocked(page)); page_mkwrite = 1; } } @@ -2764,34 +2736,18 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, pte_unmap_unlock(page_table, ptl); out: - if (dirty_page) { - struct address_space *mapping = page->mapping; - - if (set_page_dirty(dirty_page)) - page_mkwrite = 1; - unlock_page(dirty_page); - put_page(dirty_page); - if (page_mkwrite && mapping) { - /* - * Some device drivers do not set page.mapping but still - * dirty their pages - */ - balance_dirty_pages_ratelimited(mapping); - } - - /* file_update_time outside page_lock */ + unlock_page(vmf.page); +out_unlocked: + if (anon) + page_cache_release(vmf.page); + else if (dirty_page) { if (vma->vm_file) file_update_time(vma->vm_file); - } else { - unlock_page(vmf.page); - if (anon) - page_cache_release(vmf.page); - } - return ret; + set_page_dirty_balance(dirty_page, page_mkwrite); + put_page(dirty_page); + } -unwritable_page: - page_cache_release(page); return ret; } diff --git a/trunk/mm/mmap.c b/trunk/mm/mmap.c index 6b7b1a95944b..3303d1ba8e87 100644 --- a/trunk/mm/mmap.c +++ b/trunk/mm/mmap.c @@ -85,7 +85,7 @@ EXPORT_SYMBOL(vm_get_page_prot); int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ int sysctl_overcommit_ratio = 50; /* default is 50% */ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; -struct percpu_counter vm_committed_as; +atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); /* * Check that a process has enough memory to allocate a new virtual @@ -179,7 +179,11 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) if (mm) allowed -= mm->total_vm / 32; - if (percpu_counter_read_positive(&vm_committed_as) < allowed) + /* + * cast `allowed' as a signed long because vm_committed_space + * sometimes has a negative value + */ + if (atomic_long_read(&vm_committed_space) < (long)allowed) return 0; error: vm_unacct_memory(pages); @@ -2477,8 +2481,4 @@ void mm_drop_all_locks(struct mm_struct *mm) */ void __init mmap_init(void) { - int ret; - - ret = percpu_counter_init(&vm_committed_as, 0); - VM_BUG_ON(ret); } diff --git a/trunk/mm/nommu.c b/trunk/mm/nommu.c index 809998aa7b50..72eda4aee2cb 100644 --- a/trunk/mm/nommu.c +++ b/trunk/mm/nommu.c @@ -62,7 +62,7 @@ void *high_memory; struct page *mem_map; unsigned long max_mapnr; unsigned long num_physpages; -struct percpu_counter vm_committed_as; +atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ int sysctl_overcommit_ratio = 50; /* default is 50% */ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT; @@ -463,10 +463,6 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) */ void __init mmap_init(void) { - int ret; - - ret = percpu_counter_init(&vm_committed_as, 0); - VM_BUG_ON(ret); vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC); } @@ -1851,9 +1847,12 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) if (mm) allowed -= mm->total_vm / 32; - if (percpu_counter_read_positive(&vm_committed_as) < allowed) + /* + * cast `allowed' as a signed long because vm_committed_space + * sometimes has a negative value + */ + if (atomic_long_read(&vm_committed_space) < (long)allowed) return 0; - error: vm_unacct_memory(pages); diff --git a/trunk/mm/shmem.c b/trunk/mm/shmem.c index b25f95ce3db7..f9cb20ebb990 100644 --- a/trunk/mm/shmem.c +++ b/trunk/mm/shmem.c @@ -1340,12 +1340,8 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, shmem_swp_unmap(entry); spin_unlock(&info->lock); if (error == -ENOMEM) { - /* - * reclaim from proper memory cgroup and - * call memcg's OOM if needed. - */ - error = mem_cgroup_shmem_charge_fallback( - swappage, + /* allow reclaim from this memory cgroup */ + error = mem_cgroup_shrink_usage(swappage, current->mm, gfp); if (error) { diff --git a/trunk/mm/swap.c b/trunk/mm/swap.c index cb29ae5d33ab..bede23ce64ea 100644 --- a/trunk/mm/swap.c +++ b/trunk/mm/swap.c @@ -491,6 +491,49 @@ unsigned pagevec_lookup_tag(struct pagevec *pvec, struct address_space *mapping, EXPORT_SYMBOL(pagevec_lookup_tag); +#ifdef CONFIG_SMP +/* + * We tolerate a little inaccuracy to avoid ping-ponging the counter between + * CPUs + */ +#define ACCT_THRESHOLD max(16, NR_CPUS * 2) + +static DEFINE_PER_CPU(long, committed_space); + +void vm_acct_memory(long pages) +{ + long *local; + + preempt_disable(); + local = &__get_cpu_var(committed_space); + *local += pages; + if (*local > ACCT_THRESHOLD || *local < -ACCT_THRESHOLD) { + atomic_long_add(*local, &vm_committed_space); + *local = 0; + } + preempt_enable(); +} + +#ifdef CONFIG_HOTPLUG_CPU + +/* Drop the CPU's cached committed space back into the central pool. */ +static int cpu_swap_callback(struct notifier_block *nfb, + unsigned long action, + void *hcpu) +{ + long *committed; + + committed = &per_cpu(committed_space, (long)hcpu); + if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) { + atomic_long_add(*committed, &vm_committed_space); + *committed = 0; + drain_cpu_pagevecs((long)hcpu); + } + return NOTIFY_OK; +} +#endif /* CONFIG_HOTPLUG_CPU */ +#endif /* CONFIG_SMP */ + /* * Perform any setup for the swap system */ @@ -511,4 +554,7 @@ void __init swap_setup(void) * Right now other parts of the system means that we * _really_ don't want to cluster much more */ +#ifdef CONFIG_HOTPLUG_CPU + hotcpu_notifier(cpu_swap_callback, 0); +#endif } diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 5fa3eda1f03f..eac9577941f9 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -1471,7 +1471,7 @@ static void shrink_zone(int priority, struct zone *zone, for_each_evictable_lru(l) { int file = is_file_lru(l); - unsigned long scan; + int scan; scan = zone_nr_pages(zone, sc, l); if (priority) { diff --git a/trunk/scripts/kernel-doc b/trunk/scripts/kernel-doc index 3208a3a7e7fe..0f11870116dc 100755 --- a/trunk/scripts/kernel-doc +++ b/trunk/scripts/kernel-doc @@ -1411,8 +1411,7 @@ sub dump_struct($$) { my $file = shift; my $nested; - if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { - #my $decl_type = $1; + if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) { $declaration_name = $2; my $members = $3; @@ -1421,8 +1420,8 @@ sub dump_struct($$) { $nested = $1; # ignore members marked private: - $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gos; - $members =~ s/\/\*\s*private:.*//gos; + $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; + $members =~ s/\/\*.*?private:.*//gos; # strip comments: $members =~ s/\/\*.*?\*\///gos; $nested =~ s/\/\*.*?\*\///gos;