Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Sat, 28 Oct 2006 18:38:39 +0000 (11:38 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 28 Oct 2006 18:38:39 +0000 (11:38 -0700)
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
  [S390] cio: Make ccw_device_register() static.
  [S390] Improve AP bus device removal.
  [S390] uaccess error handling.
  [S390] cio: css_probe_device() must be called enabled.
  [S390] Initialize interval value to 0.
  [S390] sys_getcpu compat wrapper.

81 files changed:
arch/alpha/kernel/vmlinux.lds.S
arch/arm/kernel/vmlinux.lds.S
arch/avr32/kernel/vmlinux.lds.c
arch/frv/kernel/vmlinux.lds.S
arch/h8300/kernel/vmlinux.lds.S
arch/i386/kernel/setup.c
arch/i386/kernel/vmlinux.lds.S
arch/i386/mach-visws/visws_apic.c
arch/i386/pci/fixup.c
arch/ia64/kernel/vmlinux.lds.S
arch/ia64/pci/Makefile
arch/ia64/pci/fixup.c [new file with mode: 0644]
arch/m32r/kernel/vmlinux.lds.S
arch/m68knommu/kernel/vmlinux.lds.S
arch/mips/kernel/vmlinux.lds.S
arch/parisc/kernel/vmlinux.lds.S
arch/powerpc/kernel/vmlinux.lds.S
arch/ppc/kernel/vmlinux.lds.S
arch/s390/kernel/vmlinux.lds.S
arch/sh/kernel/vmlinux.lds.S
arch/sh64/kernel/vmlinux.lds.S
arch/sparc/kernel/ebus.c
arch/sparc/kernel/of_device.c
arch/sparc/kernel/vmlinux.lds.S
arch/sparc64/kernel/ebus.c
arch/sparc64/kernel/isa.c
arch/sparc64/kernel/of_device.c
arch/sparc64/kernel/vmlinux.lds.S
arch/v850/kernel/vmlinux.lds.S
arch/x86_64/kernel/vmlinux.lds.S
arch/x86_64/pci/mmconfig.c
arch/xtensa/kernel/vmlinux.lds.S
drivers/base/Kconfig
drivers/base/dd.c
drivers/block/cciss.c
drivers/ide/pci/generic.c
drivers/md/md.c
drivers/md/multipath.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/misc/ioc4.c
drivers/mtd/nand/nand_base.c
drivers/pci/hotplug/acpiphp_glue.c
drivers/pci/pci-driver.c
drivers/pci/quirks.c
drivers/pci/rom.c
drivers/sbus/sbus.c
fs/block_dev.c
fs/dcache.c
fs/ext4/resize.c
fs/hugetlbfs/inode.c
fs/jbd/transaction.c
fs/jbd2/transaction.c
fs/splice.c
include/asm-generic/vmlinux.lds.h
include/asm-i386/mach-visws/do_timer.h [deleted file]
include/asm-i386/mach-visws/mach_apic.h
include/linux/compat.h
include/linux/init.h
include/linux/mmzone.h
include/linux/pagemap.h
include/linux/sched.h
include/linux/taskstats_kern.h
include/linux/vmalloc.h
kernel/compat.c
kernel/cpu.c
kernel/exit.c
kernel/fork.c
kernel/module.c
kernel/taskstats.c
kernel/time/ntp.c
kernel/tsacct.c
kernel/workqueue.c
lib/string.c
mm/filemap.c
mm/hugetlb.c
mm/page_alloc.c
mm/sparse.c
mm/vmalloc.c
mm/vmscan.c
mm/vmstat.c

index 71470e9d93ba2e1c1071730093800817e194f08d..76bf071e376c9915b31fe96fc30dbb3090672a34 100644 (file)
@@ -48,13 +48,7 @@ SECTIONS
   . = ALIGN(8);
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
 
index 3ca574ee277271e04b05c79ed956337b3e7dfb7a..a8fa75ea07a991a3211da58766cb33dfbca235a9 100644 (file)
@@ -45,13 +45,7 @@ SECTIONS
                        *(.early_param.init)
                __early_end = .;
                __initcall_start = .;
-                       *(.initcall1.init)
-                       *(.initcall2.init)
-                       *(.initcall3.init)
-                       *(.initcall4.init)
-                       *(.initcall5.init)
-                       *(.initcall6.init)
-                       *(.initcall7.init)
+                       INITCALLS
                __initcall_end = .;
                __con_initcall_start = .;
                        *(.con_initcall.init)
index cdd627c6b7dc3944003c4e3603637ead2b227cb6..5c4424e362b50cbaf918ccb264693f87ccf7509b 100644 (file)
@@ -38,13 +38,7 @@ SECTIONS
                __setup_end = .;
                . = ALIGN(4);
                __initcall_start = .;
-                       *(.initcall1.init)
-                       *(.initcall2.init)
-                       *(.initcall3.init)
-                       *(.initcall4.init)
-                       *(.initcall5.init)
-                       *(.initcall6.init)
-                       *(.initcall7.init)
+                       INITCALLS
                __initcall_end = .;
                __con_initcall_start = .;
                        *(.con_initcall.init)
index f474534ba78a50ff61b7c60b31fa37121ba3de1a..9c1fb12367fa3cfbedf6b8abe926fc40eb0e431e 100644 (file)
@@ -44,13 +44,7 @@ SECTIONS
 
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init)
-       *(.initcall2.init)
-       *(.initcall3.init)
-       *(.initcall4.init)
-       *(.initcall5.init)
-       *(.initcall6.init)
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index 6406c388f88aec3a1471ac2428544ac8cd52b57b..756325dd480e40ba5cfe5056d23e2675d04ed6da 100644 (file)
@@ -118,13 +118,7 @@ SECTIONS
        . = ALIGN(0x4) ;
        ___setup_end = .;
        ___initcall_start = .;
-               *(.initcall1.init)
-               *(.initcall2.init)
-               *(.initcall3.init)
-               *(.initcall4.init)
-               *(.initcall5.init)
-               *(.initcall6.init)
-               *(.initcall7.init)
+               INITCALLS
        ___initcall_end = .;
        ___con_initcall_start = .;
                *(.con_initcall.init)
index 519e63c3c1306abb1a59b31e017d76e4e671b01d..141041dde74d0c8fe91913b445b2d68626776aed 100644 (file)
@@ -846,7 +846,7 @@ efi_find_max_pfn(unsigned long start, unsigned long end, void *arg)
 static int __init
 efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg)
 {
-       memory_present(0, start, end);
+       memory_present(0, PFN_UP(start), PFN_DOWN(end));
        return 0;
 }
 
index 1e7ac1c44ddc4a2c817712f72c85f15172a42622..adc1f232afeeddad4e92b8ee26412440966aef4d 100644 (file)
@@ -126,13 +126,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index 07097ed48890d64762e61b9f84e8b264d63c885c..38c2b13124d92c0861211866d40cdf7adda3146a 100644 (file)
@@ -122,7 +122,7 @@ static void end_cobalt_irq(unsigned int irq)
        spin_unlock_irqrestore(&cobalt_lock, flags);
 }
 
-static struct hw_interrupt_type cobalt_irq_type = {
+static struct irq_chip cobalt_irq_type = {
        .typename =     "Cobalt-APIC",
        .startup =      startup_cobalt_irq,
        .shutdown =     disable_cobalt_irq,
@@ -159,7 +159,7 @@ static void end_piix4_master_irq(unsigned int irq)
        spin_unlock_irqrestore(&cobalt_lock, flags);
 }
 
-static struct hw_interrupt_type piix4_master_irq_type = {
+static struct irq_chip piix4_master_irq_type = {
        .typename =     "PIIX4-master",
        .startup =      startup_piix4_master_irq,
        .ack =          ack_cobalt_irq,
@@ -167,9 +167,8 @@ static struct hw_interrupt_type piix4_master_irq_type = {
 };
 
 
-static struct hw_interrupt_type piix4_virtual_irq_type = {
+static struct irq_chip piix4_virtual_irq_type = {
        .typename =     "PIIX4-virtual",
-       .startup =      startup_8259A_irq,
        .shutdown =     disable_8259A_irq,
        .enable =       enable_8259A_irq,
        .disable =      disable_8259A_irq,
index 908b410f4c931c1ac62e562d2828ccd68714600f..c1949ff38d618c81dca67effe5e44c306c693b39 100644 (file)
@@ -342,6 +342,61 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,       PCI_DEVICE_ID_INTEL_MCH_PB1,    pcie_r
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_MCH_PC,     pcie_rootport_aspm_quirk );
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_MCH_PC1,    pcie_rootport_aspm_quirk );
 
+/*
+ * Fixup to mark boot BIOS video selected by BIOS before it changes
+ *
+ * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
+ *
+ * The standard boot ROM sequence for an x86 machine uses the BIOS
+ * to select an initial video card for boot display. This boot video
+ * card will have it's BIOS copied to C0000 in system RAM.
+ * IORESOURCE_ROM_SHADOW is used to associate the boot video
+ * card with this copy. On laptops this copy has to be used since
+ * the main ROM may be compressed or combined with another image.
+ * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
+ * is marked here since the boot video device will be the only enabled
+ * video device at this point.
+ */
+
+static void __devinit pci_fixup_video(struct pci_dev *pdev)
+{
+       struct pci_dev *bridge;
+       struct pci_bus *bus;
+       u16 config;
+
+       if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+               return;
+
+       /* Is VGA routed to us? */
+       bus = pdev->bus;
+       while (bus) {
+               bridge = bus->self;
+
+               /*
+                * From information provided by
+                * "David Miller" <davem@davemloft.net>
+                * The bridge control register is valid for PCI header
+                * type BRIDGE, or CARDBUS. Host to PCI controllers use
+                * PCI header type NORMAL.
+                */
+               if (bridge
+                   &&((bridge->hdr_type == PCI_HEADER_TYPE_BRIDGE)
+                      ||(bridge->hdr_type == PCI_HEADER_TYPE_CARDBUS))) {
+                       pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
+                                               &config);
+                       if (!(config & PCI_BRIDGE_CTL_VGA))
+                               return;
+               }
+               bus = bus->parent;
+       }
+       pci_read_config_word(pdev, PCI_COMMAND, &config);
+       if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+               pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
+               printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
+       }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
+
 /*
  * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
  *
index b3b2e389d6b2e2abc690f37e7e62bb39127afaba..d6083a0936f4e2e3ddd2c425e41ef0afc33ecb97 100644 (file)
@@ -128,13 +128,7 @@ SECTIONS
   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET)
        {
          __initcall_start = .;
-         *(.initcall1.init)
-         *(.initcall2.init)
-         *(.initcall3.init)
-         *(.initcall4.init)
-         *(.initcall5.init)
-         *(.initcall6.init)
-         *(.initcall7.init)
+       INITCALLS
          __initcall_end = .;
        }
 
index e66889e6922a23e628cf9faaa603c8e6c71b783c..fb14dc520d2ddc9f6e82fc733d0184114e266038 100644 (file)
@@ -1,4 +1,4 @@
 #
 # Makefile for the ia64-specific parts of the pci bus
 #
-obj-y          := pci.o
+obj-y          := pci.o fixup.o
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
new file mode 100644 (file)
index 0000000..245dc1f
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Exceptions for specific devices. Usually work-arounds for fatal design flaws.
+ * Derived from fixup.c of i386 tree.
+ */
+
+#include <linux/pci.h>
+#include <linux/init.h>
+
+#include <asm/machvec.h>
+
+/*
+ * Fixup to mark boot BIOS video selected by BIOS before it changes
+ *
+ * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
+ *
+ * The standard boot ROM sequence for an x86 machine uses the BIOS
+ * to select an initial video card for boot display. This boot video
+ * card will have it's BIOS copied to C0000 in system RAM.
+ * IORESOURCE_ROM_SHADOW is used to associate the boot video
+ * card with this copy. On laptops this copy has to be used since
+ * the main ROM may be compressed or combined with another image.
+ * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
+ * is marked here since the boot video device will be the only enabled
+ * video device at this point.
+ */
+
+static void __devinit pci_fixup_video(struct pci_dev *pdev)
+{
+       struct pci_dev *bridge;
+       struct pci_bus *bus;
+       u16 config;
+
+       if ((strcmp(platform_name, "dig") != 0)
+           && (strcmp(platform_name, "hpzx1")  != 0))
+               return;
+       /* Maybe, this machine supports legacy memory map. */
+
+       if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+               return;
+
+       /* Is VGA routed to us? */
+       bus = pdev->bus;
+       while (bus) {
+               bridge = bus->self;
+
+               /*
+                * From information provided by
+                * "David Miller" <davem@davemloft.net>
+                * The bridge control register is valid for PCI header
+                * type BRIDGE, or CARDBUS. Host to PCI controllers use
+                * PCI header type NORMAL.
+                */
+               if (bridge
+                   &&((bridge->hdr_type == PCI_HEADER_TYPE_BRIDGE)
+                      ||(bridge->hdr_type == PCI_HEADER_TYPE_CARDBUS))) {
+                       pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
+                                               &config);
+                       if (!(config & PCI_BRIDGE_CTL_VGA))
+                               return;
+               }
+               bus = bus->parent;
+       }
+       pci_read_config_word(pdev, PCI_COMMAND, &config);
+       if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+               pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
+               printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
+       }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
index 13c7bb698e376ac10164753093d83db15dfd6228..358b9cee2c6585c0a84d42e9e22ef4c7fbe52b64 100644 (file)
@@ -83,13 +83,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init)
-       *(.initcall2.init)
-       *(.initcall3.init)
-       *(.initcall4.init)
-       *(.initcall5.init)
-       *(.initcall6.init)
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index ccd2ceb05cfbc60fce2018bc0167e2cafcfa143c..58afa8be604ea1f1f6ab308e3634ea258f63c4bc 100644 (file)
@@ -140,13 +140,7 @@ SECTIONS {
                *(.init.setup)
                __setup_end = .;
                __initcall_start = .;
-               *(.initcall1.init)
-               *(.initcall2.init)
-               *(.initcall3.init)
-               *(.initcall4.init)
-               *(.initcall5.init)
-               *(.initcall6.init)
-               *(.initcall7.init)
+               INITCALLS
                __initcall_end = .;
                __con_initcall_start = .;
                *(.con_initcall.init)
index 0bb9cd8894567d80697e52f51ec0f2228ca18824..25ed3337ce3590cf0376e070f6433e3ef03340d1 100644 (file)
@@ -91,13 +91,7 @@ SECTIONS
 
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init)
-       *(.initcall2.init)
-       *(.initcall3.init)
-       *(.initcall4.init)
-       *(.initcall5.init)
-       *(.initcall6.init)
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
 
index b3677fc8eef597fb9f4ebeb6fda0249e4a48f5f2..7b943b45f7cd518f7749aa50fcf6ed081d5615f0 100644 (file)
@@ -153,13 +153,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index cb0e8d46c3e8fa383f2be4f9d23cc1428ee39e09..e8342d86753675d0ad20b3866bcdb12165d30d49 100644 (file)
@@ -108,13 +108,7 @@ SECTIONS
 
        .initcall.init : {
                __initcall_start = .;
-               *(.initcall1.init)
-               *(.initcall2.init)
-               *(.initcall3.init)
-               *(.initcall4.init)
-               *(.initcall5.init)
-               *(.initcall6.init)
-               *(.initcall7.init)
+               INITCALLS
                __initcall_end = .;
                }
 
index 095fd3323323b077a3acbcdcdf00e91c7bacce02..16e8661e1fec331cf5fee951288ca6440de0e09b 100644 (file)
@@ -115,13 +115,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init)
-       *(.initcall2.init)
-       *(.initcall3.init)
-       *(.initcall4.init)
-       *(.initcall5.init)
-       *(.initcall6.init)
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
 
index af9e69a030112ae2c90428bc5fef2a41931c870b..fe0f2e97ba7bb8f063b174a4a1cbe53cda0d350e 100644 (file)
@@ -83,13 +83,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index 5eb9309181865a15343d39934af2bf282ef57c94..77b4026d5688683820a6ba83388f457a1f860a77 100644 (file)
@@ -76,13 +76,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index a8fcc3a71585da3dbe4dd2ebc7b111c86f69d742..95c4d753e357132bc6e98ac8a3c4a465ba106451 100644 (file)
@@ -108,13 +108,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : C_PHYS(.initcall.init) {
-       *(.initcall1.init)
-       *(.initcall2.init)
-       *(.initcall3.init)
-       *(.initcall4.init)
-       *(.initcall5.init)
-       *(.initcall6.init)
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index 75ac24d229b1dda145b04ac1f68f317e050e47b3..ba58c3a061fdaaa8ff28b457bda1cf4152c34d52 100644 (file)
@@ -237,12 +237,12 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
        dev->ofdev.node = dp;
        dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
        dev->ofdev.dev.bus = &ebus_bus_type;
-       strcpy(dev->ofdev.dev.bus_id, dp->path_component_name);
+       sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node);
 
        /* Register with core */
        if (of_device_register(&dev->ofdev) != 0)
                printk(KERN_DEBUG "ebus: device registration error for %s!\n",
-                      dev->ofdev.dev.bus_id);
+                      dp->path_component_name);
 
        if ((dp = dp->child) != NULL) {
                dev->children = (struct linux_ebus_child *)
@@ -332,12 +332,12 @@ void __init ebus_init(void)
                ebus->ofdev.node = dp;
                ebus->ofdev.dev.parent = &pdev->dev;
                ebus->ofdev.dev.bus = &ebus_bus_type;
-               strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name);
+               sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus);
 
                /* Register with core */
                if (of_device_register(&ebus->ofdev) != 0)
                        printk(KERN_DEBUG "ebus: device registration error for %s!\n",
-                              ebus->ofdev.dev.bus_id);
+                              dp->path_component_name);
 
 
                nd = dp->child;
index 74bef2a2d37f8461df87fe43ce95a5d276ad8ab9..46200c43ffb129a4ed51f3430126d927895d29f4 100644 (file)
@@ -651,7 +651,7 @@ build_resources:
        if (!parent)
                strcpy(op->dev.bus_id, "root");
        else
-               strcpy(op->dev.bus_id, dp->path_component_name);
+               sprintf(op->dev.bus_id, "%08x", dp->node);
 
        if (of_device_register(op)) {
                printk("%s: Could not register of device.\n",
index 1dd78c84888a3e1556645537db9c3f549d62f92d..5cc5ff7f8824d04f12665e12423b970fbf273553 100644 (file)
@@ -49,13 +49,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index 2df25c2b4071e92b7dea55dd32d5e34f4c2413db..35bf895fdeee04bbc1b697e9554060eb2a341625 100644 (file)
@@ -389,12 +389,12 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de
        dev->ofdev.node = dp;
        dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
        dev->ofdev.dev.bus = &ebus_bus_type;
-       strcpy(dev->ofdev.dev.bus_id, dp->path_component_name);
+       sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node);
 
        /* Register with core */
        if (of_device_register(&dev->ofdev) != 0)
                printk(KERN_DEBUG "ebus: device registration error for %s!\n",
-                      dev->ofdev.dev.bus_id);
+                      dp->path_component_name);
 
        dp = dp->child;
        if (dp) {
@@ -494,12 +494,12 @@ void __init ebus_init(void)
                ebus->ofdev.node = dp;
                ebus->ofdev.dev.parent = &pdev->dev;
                ebus->ofdev.dev.bus = &ebus_bus_type;
-               strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name);
+               sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus);
 
                /* Register with core */
                if (of_device_register(&ebus->ofdev) != 0)
                        printk(KERN_DEBUG "ebus: device registration error for %s!\n",
-                              ebus->ofdev.dev.bus_id);
+                              dp->path_component_name);
 
 
                child = dp->child;
index 0f3aec72ef5fc3161530997853502f4d985e5052..f028e68b23f2acf6b6546d63b39f985db3f10ee5 100644 (file)
@@ -115,12 +115,12 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
                isa_dev->ofdev.node = dp;
                isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev;
                isa_dev->ofdev.dev.bus = &isa_bus_type;
-               strcpy(isa_dev->ofdev.dev.bus_id, dp->path_component_name);
+               sprintf(isa_dev->ofdev.dev.bus_id, "isa[%08x]", dp->node);
 
                /* Register with core */
                if (of_device_register(&isa_dev->ofdev) != 0) {
                        printk(KERN_DEBUG "isa: device registration error for %s!\n",
-                              isa_dev->ofdev.dev.bus_id);
+                              dp->path_component_name);
                        kfree(isa_dev);
                        goto next_sibling;
                }
@@ -191,12 +191,12 @@ void __init isa_init(void)
                isa_br->ofdev.node = dp;
                isa_br->ofdev.dev.parent = &pdev->dev;
                isa_br->ofdev.dev.bus = &isa_bus_type;
-               strcpy(isa_br->ofdev.dev.bus_id, dp->path_component_name);
+               sprintf(isa_br->ofdev.dev.bus_id, "isa%d", index);
 
                /* Register with core */
                if (of_device_register(&isa_br->ofdev) != 0) {
                        printk(KERN_DEBUG "isa: device registration error for %s!\n",
-                              isa_br->ofdev.dev.bus_id);
+                              dp->path_component_name);
                        kfree(isa_br);
                        return;
                }
index 983ca5f485cfe34ad0e2c78b7dfcc9d6740043f7..8cc14fc6b6f13ff028489260c1e8aa155c791019 100644 (file)
@@ -861,7 +861,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
        if (!parent)
                strcpy(op->dev.bus_id, "root");
        else
-               sprintf(op->dev.bus_id, "%s@%08x", dp->name, dp->node);
+               sprintf(op->dev.bus_id, "%08x", dp->node);
 
        if (of_device_register(op)) {
                printk("%s: Could not register of device.\n",
index b097379a49a8f2a7ff76f5fcd442434db0fb5138..bd9de8c2a2aa1c29158134d0bdaf04754efc8703 100644 (file)
@@ -57,13 +57,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index 63399219cd9fca731fe4c7b473ce2288a1914ad4..88d087f527c9ff20b3e7bc591685e6c0cf309367 100644 (file)
                ___setup_end = . ;                                            \
                ___initcall_start = . ;                                       \
                        *(.initcall.init)                                     \
-                       *(.initcall1.init)                                    \
-                       *(.initcall2.init)                                    \
-                       *(.initcall3.init)                                    \
-                       *(.initcall4.init)                                    \
-                       *(.initcall5.init)                                    \
-                       *(.initcall6.init)                                    \
-                       *(.initcall7.init)                                    \
+                       INITCALLS                                             \
                . = ALIGN (4) ;                                               \
                ___initcall_end = . ;                                         \
                ___con_initcall_start = .;                                    \
index 1283614c9b247674ee75fd865744c9a95d902379..edb24aa714b4e0d58f1bbebe70b1e699abb16ce7 100644 (file)
@@ -175,13 +175,7 @@ SECTIONS
   __setup_end = .;
   __initcall_start = .;
   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
-       *(.initcall1.init) 
-       *(.initcall2.init) 
-       *(.initcall3.init) 
-       *(.initcall4.init) 
-       *(.initcall5.init) 
-       *(.initcall6.init) 
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
   __con_initcall_start = .;
index 7732f4254d21810a4c5441278032169bf59f7e36..e61093b34c268ea77590a0f3545458f5def50674 100644 (file)
@@ -220,7 +220,7 @@ void __init pci_mmcfg_init(int type)
 
        pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL);
        if (pci_mmcfg_virt == NULL) {
-               printk("PCI: Can not allocate memory for mmconfig structures\n");
+               printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n");
                return;
        }
        for (i = 0; i < pci_mmcfg_config_num; ++i) {
@@ -228,7 +228,8 @@ void __init pci_mmcfg_init(int type)
                pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].base_address,
                                                         MMCONFIG_APER_MAX);
                if (!pci_mmcfg_virt[i].virt) {
-                       printk("PCI: Cannot map mmconfig aperture for segment %d\n",
+                       printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
+                                       "segment %d\n",
                               pci_mmcfg_config[i].pci_segment_group_number);
                        return;
                }
index ab6cdbd5eb684ab9eb0f78b2bda2fff08c6a7a2b..cfe75f52872593f9bdefa8c7871421e4bc89848b 100644 (file)
@@ -184,13 +184,7 @@ SECTIONS
 
   __initcall_start = .;
   .initcall.init : {
-       *(.initcall1.init)
-       *(.initcall2.init)
-       *(.initcall3.init)
-       *(.initcall4.init)
-       *(.initcall5.init)
-       *(.initcall6.init)
-       *(.initcall7.init)
+       INITCALLS
   }
   __initcall_end = .;
 
index 0b4e22436935d8c4403a5d0dafa8090780cbca3e..1429f3a2629e60003e575bb02c5dd6fe97470e3c 100644 (file)
@@ -37,8 +37,8 @@ config DEBUG_DRIVER
 
          If you are unsure about this, say N here.
 
-endmenu
-
 config SYS_HYPERVISOR
        bool
        default n
+
+endmenu
index db01b95a47a501d5976c04d66052a8809f026f29..c5d6bb4290ad2d8fa24c279dc71aaef0b0eb46e4 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
+#include <linux/wait.h>
 
 #include "base.h"
 #include "power/power.h"
@@ -70,6 +71,8 @@ struct stupid_thread_structure {
 };
 
 static atomic_t probe_count = ATOMIC_INIT(0);
+static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue);
+
 static int really_probe(void *void_data)
 {
        struct stupid_thread_structure *data = void_data;
@@ -121,6 +124,7 @@ probe_failed:
 done:
        kfree(data);
        atomic_dec(&probe_count);
+       wake_up(&probe_waitqueue);
        return ret;
 }
 
@@ -337,6 +341,32 @@ void driver_detach(struct device_driver * drv)
        }
 }
 
+#ifdef CONFIG_PCI_MULTITHREAD_PROBE
+static int __init wait_for_probes(void)
+{
+       DEFINE_WAIT(wait);
+
+       printk(KERN_INFO "%s: waiting for %d threads\n", __FUNCTION__,
+                       atomic_read(&probe_count));
+       if (!atomic_read(&probe_count))
+               return 0;
+       while (atomic_read(&probe_count)) {
+               prepare_to_wait(&probe_waitqueue, &wait, TASK_UNINTERRUPTIBLE);
+               if (atomic_read(&probe_count))
+                       schedule();
+       }
+       finish_wait(&probe_waitqueue, &wait);
+       return 0;
+}
+
+core_initcall_sync(wait_for_probes);
+postcore_initcall_sync(wait_for_probes);
+arch_initcall_sync(wait_for_probes);
+subsys_initcall_sync(wait_for_probes);
+fs_initcall_sync(wait_for_probes);
+device_initcall_sync(wait_for_probes);
+late_initcall_sync(wait_for_probes);
+#endif
 
 EXPORT_SYMBOL_GPL(device_bind_driver);
 EXPORT_SYMBOL_GPL(device_release_driver);
index bc6602606fb541726f1537f610cc4d80d340ca2d..6ffe2b2bdacce4f283d628088264593fa2b6c1d1 100644 (file)
@@ -1992,8 +1992,8 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
                *block_size = BLOCK_SIZE;
        }
        if (*total_size != (__u32) 0)
-               printk(KERN_INFO "      blocks= %lld block_size= %d\n",
-               *total_size, *block_size);
+               printk(KERN_INFO "      blocks= %llu block_size= %d\n",
+               (unsigned long long)*total_size, *block_size);
        kfree(buf);
        return;
 }
@@ -2027,8 +2027,8 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
                *total_size = 0;
                *block_size = BLOCK_SIZE;
        }
-       printk(KERN_INFO "      blocks= %lld block_size= %d\n",
-              *total_size, *block_size);
+       printk(KERN_INFO "      blocks= %llu block_size= %d\n",
+              (unsigned long long)*total_size, *block_size);
        kfree(buf);
        return;
 }
index ad418ce882cae837a77537fc8e54f2b909bfac7f..e72ab36a5494e3a695e17c8fb5bc238db5d562d1 100644 (file)
@@ -247,8 +247,10 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
            (!(PCI_FUNC(dev->devfn) & 1)))
                goto out;
 
-       if (dev->vendor == PCI_VENDOR_ID_JMICRON && PCI_FUNC(dev->devfn) != 1)
-               goto out;
+       if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
+               if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
+                       goto out;
+       }
 
        if (dev->vendor != PCI_VENDOR_ID_JMICRON) {
                pci_read_config_word(dev, PCI_COMMAND, &command);
index 7daa7b1e145f32d3736a48e7e9ee6e81f94c5bb8..50ab4a936e30a3e405e314f648049c518446e018 100644 (file)
@@ -2003,6 +2003,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
        kobject_init(&rdev->kobj);
 
        rdev->desc_nr = -1;
+       rdev->saved_raid_disk = -1;
        rdev->flags = 0;
        rdev->data_offset = 0;
        rdev->sb_events = 0;
@@ -4044,11 +4045,8 @@ static int update_size(mddev_t *mddev, unsigned long size)
                return -EBUSY;
        ITERATE_RDEV(mddev,rdev,tmp) {
                sector_t avail;
-               if (rdev->sb_offset > rdev->data_offset)
-                       avail = (rdev->sb_offset*2) - rdev->data_offset;
-               else
-                       avail = get_capacity(rdev->bdev->bd_disk)
-                               - rdev->data_offset;
+               avail = rdev->size * 2;
+
                if (fit && (size == 0 || size > avail/2))
                        size = avail/2;
                if (avail < ((sector_t)size << 1))
index a6260f0e3b9e57bf756ac32c8e75f15c37d47f12..14da37fee37b428b72f2f5339f465ad4bfa3e3e8 100644 (file)
@@ -277,6 +277,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
                        set_bit(Faulty, &rdev->flags);
                        set_bit(MD_CHANGE_DEVS, &mddev->flags);
                        conf->working_disks--;
+                       mddev->degraded++;
                        printk(KERN_ALERT "multipath: IO failure on %s,"
                                " disabling IO path. \n Operation continuing"
                                " on %d IO paths.\n",
@@ -336,6 +337,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
                                blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);
 
                        conf->working_disks++;
+                       mddev->degraded--;
                        rdev->raid_disk = path;
                        set_bit(In_sync, &rdev->flags);
                        rcu_assign_pointer(p->rdev, rdev);
index dc9d2def0270df7460a4eb0e20c4cf494ae94319..656fae912fe3550e06a17f14a851f05a7dd63fd2 100644 (file)
@@ -1474,8 +1474,8 @@ static void fix_read_error(conf_t *conf, int read_disk,
                                               "raid1:%s: read error corrected "
                                               "(%d sectors at %llu on %s)\n",
                                               mdname(mddev), s,
-                                              (unsigned long long)sect +
-                                                  rdev->data_offset,
+                                              (unsigned long long)(sect +
+                                                  rdev->data_offset),
                                               bdevname(rdev->bdev, b));
                                }
                        }
index 74f17a9a6ebb78cca440a4c08b317b3f74a414a3..7492d6033ac634250c74f84e9e66273f83ff06b6 100644 (file)
@@ -1470,8 +1470,8 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
                                               "raid10:%s: read error corrected"
                                               " (%d sectors at %llu on %s)\n",
                                               mdname(mddev), s,
-                                              (unsigned long long)sect+
-                                                   rdev->data_offset,
+                                              (unsigned long long)(sect+
+                                                   rdev->data_offset),
                                               bdevname(rdev->bdev, b));
 
                                rdev_dec_pending(rdev, mddev);
index 79354bbbbd6a12c8ae0e22de5b73cda47da8fde8..b995a15b7526a43d12439ce955fb91579d4cff72 100644 (file)
@@ -210,8 +210,8 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
 
                do_div(ns, IOC4_EXTINT_COUNT_DIVISOR);
                printk(KERN_DEBUG
-                      "IOC4 %s: PCI clock is %lld ns.\n",
-                      pci_name(idd->idd_pdev), ns);
+                      "IOC4 %s: PCI clock is %llu ns.\n",
+                      pci_name(idd->idd_pdev), (unsigned long long)ns);
        }
 
        /* Remember results.  We store the extint clock period rather
index baece61169f4933af73704779143ddbaf21c08f7..41bfcae1fbf46ebbfb8aa2457efaf9f7d1723529 100644 (file)
@@ -1479,6 +1479,7 @@ static void nand_write_page_syndrome(struct mtd_info *mtd,
  * @buf:       the data to write
  * @page:      page number to write
  * @cached:    cached programming
+ * @raw:       use _raw version of write_page
  */
 static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
                           const uint8_t *buf, int page, int cached, int raw)
index c44311ac2fd36ee1de1693e8fc7695acbd2e6101..16167b016266c0499cd4c9f26900b0f48ba5c76e 100644 (file)
@@ -1807,8 +1807,8 @@ u8 acpiphp_get_power_status(struct acpiphp_slot *slot)
 
 
 /*
- * latch closed:  1
- * latch   open:  0
+ * latch   open:  1
+ * latch closed:  0
  */
 u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
 {
@@ -1816,7 +1816,7 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
 
        sta = get_slot_status(slot);
 
-       return (sta & ACPI_STA_SHOW_IN_UI) ? 1 : 0;
+       return (sta & ACPI_STA_SHOW_IN_UI) ? 0 : 1;
 }
 
 
index b1c0c707d96ccc6e713042b1d67167609199c723..194f1d21d3d784d3ce73301acf42ff5c38240e32 100644 (file)
@@ -264,6 +264,13 @@ static int pci_device_remove(struct device * dev)
                pci_dev->driver = NULL;
        }
 
+       /*
+        * If the device is still on, set the power state as "unknown",
+        * since it might change by the next time we load the driver.
+        */
+       if (pci_dev->current_state == PCI_D0)
+               pci_dev->current_state = PCI_UNKNOWN;
+
        /*
         * We would love to complain here if pci_dev->is_enabled is set, that
         * the driver should have called pci_disable_device(), but the
@@ -288,6 +295,12 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
                suspend_report_result(drv->suspend, i);
        } else {
                pci_save_state(pci_dev);
+               /*
+                * mark its power state as "unknown", since we don't know if
+                * e.g. the BIOS will change its device state when we suspend.
+                */
+               if (pci_dev->current_state == PCI_D0)
+                       pci_dev->current_state = PCI_UNKNOWN;
        }
        return i;
 }
index e8a7f1b1b2bc4289546066375d1ef4b2e5792217..204b1c8e972bcaa06c43b6900ecebb7a9a99bde3 100644 (file)
@@ -714,33 +714,6 @@ static void __devinit quirk_vt82c598_id(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA,    PCI_DEVICE_ID_VIA_82C597_0,     quirk_vt82c598_id );
 
-#ifdef CONFIG_ACPI_SLEEP
-
-/*
- * Some VIA systems boot with the abnormal status flag set. This can cause
- * the BIOS to re-POST the system on resume rather than passing control
- * back to the OS.  Clear the flag on boot
- */
-static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev)
-{
-       u32 reg;
-
-       acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
-                               &reg);
-
-       if (reg & 0x800) {
-               printk("Clearing abnormal poweroff flag\n");
-               acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
-                                       ACPI_REGISTER_PM1_STATUS,
-                                       (u16)0x800);
-       }
-}
-
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff);
-
-#endif
-
 /*
  * CardBus controllers have a legacy base address that enables them
  * to respond as i82365 pcmcia controllers.  We don't want them to
@@ -1619,52 +1592,6 @@ static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
 
-/*
- * Fixup to mark boot BIOS video selected by BIOS before it changes
- *
- * From information provided by "Jon Smirl" <jonsmirl@gmail.com>
- *
- * The standard boot ROM sequence for an x86 machine uses the BIOS
- * to select an initial video card for boot display. This boot video
- * card will have it's BIOS copied to C0000 in system RAM.
- * IORESOURCE_ROM_SHADOW is used to associate the boot video
- * card with this copy. On laptops this copy has to be used since
- * the main ROM may be compressed or combined with another image.
- * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW
- * is marked here since the boot video device will be the only enabled
- * video device at this point.
- */
-
-static void __devinit fixup_video(struct pci_dev *pdev)
-{
-       struct pci_dev *bridge;
-       struct pci_bus *bus;
-       u16 config;
-
-       if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
-               return;
-
-       /* Is VGA routed to us? */
-       bus = pdev->bus;
-       while (bus) {
-               bridge = bus->self;
-               if (bridge) {
-                       pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
-                                               &config);
-                       if (!(config & PCI_BRIDGE_CTL_VGA))
-                               return;
-               }
-               bus = bus->parent;
-       }
-       pci_read_config_word(pdev, PCI_COMMAND, &config);
-       if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
-               pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
-               printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
-       }
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_video);
-
-
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end)
 {
        while (f < end) {
index 43e4a49f2cc428275cc77a74bb52c61fe9d428b3..e1dcefc69bb4fb14873ff0c8622d7a971eb21330 100644 (file)
@@ -72,8 +72,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
        int last_image;
 
        /*
-        * IORESOURCE_ROM_SHADOW set if the VGA enable bit of the Bridge Control
-        * register is set for embedded VGA.
+        * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
+        * memory map if the VGA enable bit of the Bridge Control register is
+        * set for embedded VGA.
         */
        if (res->flags & IORESOURCE_ROM_SHADOW) {
                /* primary video rom always starts here */
index 935952ef88f19d04127a560a2b2942d5a54c9c56..98fcbb3d5560bad9463109915e64f75222558853 100644 (file)
@@ -61,11 +61,11 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde
        else
                sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev;
        sdev->ofdev.dev.bus = &sbus_bus_type;
-       strcpy(sdev->ofdev.dev.bus_id, dp->path_component_name);
+       sprintf(sdev->ofdev.dev.bus_id, "sbus[%08x]", dp->node);
 
        if (of_device_register(&sdev->ofdev) != 0)
                printk(KERN_DEBUG "sbus: device registration error for %s!\n",
-                      sdev->ofdev.dev.bus_id);
+                      dp->path_component_name);
 }
 
 static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus)
index bc8f27cc448314b2eaf99cc93628671d51d5adc1..702b88cbd91d2dc91eb81cb41784574b89df4edd 100644 (file)
@@ -1131,6 +1131,8 @@ static int blkdev_open(struct inode * inode, struct file * filp)
        filp->f_flags |= O_LARGEFILE;
 
        bdev = bd_acquire(inode);
+       if (bdev == NULL)
+               return -ENOMEM;
 
        res = do_open(bdev, filp, BD_MUTEX_NORMAL);
        if (res)
index a1ff91eef10810c50583962ae671f07e14737bf6..fd4a428998efe1152c01129defec0691ac87a465 100644 (file)
@@ -478,11 +478,12 @@ static void prune_dcache(int count, struct super_block *sb)
                        up_read(s_umount);
                }
                spin_unlock(&dentry->d_lock);
-               /* Cannot remove the first dentry, and it isn't appropriate
-                * to move it to the head of the list, so give up, and try
-                * later
+               /*
+                * Insert dentry at the head of the list as inserting at the
+                * tail leads to a cycle.
                 */
-               break;
+               list_add(&dentry->d_lru, &dentry_unused);
+               dentry_stat.nr_unused++;
        }
        spin_unlock(&dcache_lock);
 }
@@ -556,6 +557,7 @@ repeat:
 static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
 {
        struct dentry *parent;
+       unsigned detached = 0;
 
        BUG_ON(!IS_ROOT(dentry));
 
@@ -620,7 +622,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
                                atomic_dec(&parent->d_count);
 
                        list_del(&dentry->d_u.d_child);
-                       dentry_stat.nr_dentry--;        /* For d_free, below */
+                       detached++;
 
                        inode = dentry->d_inode;
                        if (inode) {
@@ -638,7 +640,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
                         * otherwise we ascend to the parent and move to the
                         * next sibling if there is one */
                        if (!parent)
-                               return;
+                               goto out;
 
                        dentry = parent;
 
@@ -647,6 +649,11 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
                dentry = list_entry(dentry->d_subdirs.next,
                                    struct dentry, d_u.d_child);
        }
+out:
+       /* several dentries were freed, need to correct nr_dentry */
+       spin_lock(&dcache_lock);
+       dentry_stat.nr_dentry -= detached;
+       spin_unlock(&dcache_lock);
 }
 
 /*
index 1e9578052cd35b3cba19c87f5ab8f948d057452d..4fe49c3661b286990b76b2bc939325804565f9b6 100644 (file)
@@ -69,44 +69,49 @@ static int verify_group_input(struct super_block *sb,
        else if (outside(input->block_bitmap, start, end))
                ext4_warning(sb, __FUNCTION__,
                             "Block bitmap not in group (block %llu)",
-                            input->block_bitmap);
+                            (unsigned long long)input->block_bitmap);
        else if (outside(input->inode_bitmap, start, end))
                ext4_warning(sb, __FUNCTION__,
                             "Inode bitmap not in group (block %llu)",
-                            input->inode_bitmap);
+                            (unsigned long long)input->inode_bitmap);
        else if (outside(input->inode_table, start, end) ||
                 outside(itend - 1, start, end))
                ext4_warning(sb, __FUNCTION__,
                             "Inode table not in group (blocks %llu-%llu)",
-                            input->inode_table, itend - 1);
+                            (unsigned long long)input->inode_table, itend - 1);
        else if (input->inode_bitmap == input->block_bitmap)
                ext4_warning(sb, __FUNCTION__,
                             "Block bitmap same as inode bitmap (%llu)",
-                            input->block_bitmap);
+                            (unsigned long long)input->block_bitmap);
        else if (inside(input->block_bitmap, input->inode_table, itend))
                ext4_warning(sb, __FUNCTION__,
                             "Block bitmap (%llu) in inode table (%llu-%llu)",
-                            input->block_bitmap, input->inode_table, itend-1);
+                            (unsigned long long)input->block_bitmap,
+                            (unsigned long long)input->inode_table, itend - 1);
        else if (inside(input->inode_bitmap, input->inode_table, itend))
                ext4_warning(sb, __FUNCTION__,
                             "Inode bitmap (%llu) in inode table (%llu-%llu)",
-                            input->inode_bitmap, input->inode_table, itend-1);
+                            (unsigned long long)input->inode_bitmap,
+                            (unsigned long long)input->inode_table, itend - 1);
        else if (inside(input->block_bitmap, start, metaend))
                ext4_warning(sb, __FUNCTION__,
                             "Block bitmap (%llu) in GDT table"
                             " (%llu-%llu)",
-                            input->block_bitmap, start, metaend - 1);
+                            (unsigned long long)input->block_bitmap,
+                            start, metaend - 1);
        else if (inside(input->inode_bitmap, start, metaend))
                ext4_warning(sb, __FUNCTION__,
                             "Inode bitmap (%llu) in GDT table"
                             " (%llu-%llu)",
-                            input->inode_bitmap, start, metaend - 1);
+                            (unsigned long long)input->inode_bitmap,
+                            start, metaend - 1);
        else if (inside(input->inode_table, start, metaend) ||
                 inside(itend - 1, start, metaend))
                ext4_warning(sb, __FUNCTION__,
                             "Inode table (%llu-%llu) overlaps"
                             "GDT table (%llu-%llu)",
-                            input->inode_table, itend - 1, start, metaend - 1);
+                            (unsigned long long)input->inode_table,
+                            itend - 1, start, metaend - 1);
        else
                err = 0;
        brelse(bh);
index 4ee3f006b861940f6d27c2b09711504498d59607..0bea6a619e100e0baa4eee8bc689c935b88ff2cc 100644 (file)
@@ -271,26 +271,24 @@ static void hugetlbfs_drop_inode(struct inode *inode)
                hugetlbfs_forget_inode(inode);
 }
 
-/*
- * h_pgoff is in HPAGE_SIZE units.
- * vma->vm_pgoff is in PAGE_SIZE units.
- */
 static inline void
-hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff)
+hugetlb_vmtruncate_list(struct prio_tree_root *root, pgoff_t pgoff)
 {
        struct vm_area_struct *vma;
        struct prio_tree_iter iter;
 
-       vma_prio_tree_foreach(vma, &iter, root, h_pgoff, ULONG_MAX) {
-               unsigned long h_vm_pgoff;
+       vma_prio_tree_foreach(vma, &iter, root, pgoff, ULONG_MAX) {
                unsigned long v_offset;
 
-               h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
-               v_offset = (h_pgoff - h_vm_pgoff) << HPAGE_SHIFT;
                /*
-                * Is this VMA fully outside the truncation point?
+                * Can the expression below overflow on 32-bit arches?
+                * No, because the prio_tree returns us only those vmas
+                * which overlap the truncated area starting at pgoff,
+                * and no vma on a 32-bit arch can span beyond the 4GB.
                 */
-               if (h_vm_pgoff >= h_pgoff)
+               if (vma->vm_pgoff < pgoff)
+                       v_offset = (pgoff - vma->vm_pgoff) << PAGE_SHIFT;
+               else
                        v_offset = 0;
 
                __unmap_hugepage_range(vma,
@@ -303,14 +301,14 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff)
  */
 static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
 {
-       unsigned long pgoff;
+       pgoff_t pgoff;
        struct address_space *mapping = inode->i_mapping;
 
        if (offset > inode->i_size)
                return -EINVAL;
 
        BUG_ON(offset & ~HPAGE_MASK);
-       pgoff = offset >> HPAGE_SHIFT;
+       pgoff = offset >> PAGE_SHIFT;
 
        inode->i_size = offset;
        spin_lock(&mapping->i_mmap_lock);
@@ -624,7 +622,6 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig)
                                do_div(size, 100);
                                rest++;
                        }
-                       size &= HPAGE_MASK;
                        pconfig->nr_blocks = (size >> HPAGE_SHIFT);
                        value = rest;
                } else if (!strcmp(opt,"nr_inodes")) {
index d5c63047a8b3f89584963a31c85e22f08ee831c6..4f82bcd63e488a6a1b0ff1b8bb20bb7e2a968b3c 100644 (file)
@@ -967,6 +967,13 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh)
         */
        jbd_lock_bh_state(bh);
        spin_lock(&journal->j_list_lock);
+
+       /* Now that we have bh_state locked, are we really still mapped? */
+       if (!buffer_mapped(bh)) {
+               JBUFFER_TRACE(jh, "unmapped buffer, bailing out");
+               goto no_journal;
+       }
+
        if (jh->b_transaction) {
                JBUFFER_TRACE(jh, "has transaction");
                if (jh->b_transaction != handle->h_transaction) {
@@ -1028,6 +1035,11 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh)
                                sync_dirty_buffer(bh);
                                jbd_lock_bh_state(bh);
                                spin_lock(&journal->j_list_lock);
+                               /* Since we dropped the lock... */
+                               if (!buffer_mapped(bh)) {
+                                       JBUFFER_TRACE(jh, "buffer got unmapped");
+                                       goto no_journal;
+                               }
                                /* The buffer may become locked again at any
                                   time if it is redirtied */
                        }
@@ -1824,6 +1836,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                        }
                }
        } else if (transaction == journal->j_committing_transaction) {
+               JBUFFER_TRACE(jh, "on committing transaction");
                if (jh->b_jlist == BJ_Locked) {
                        /*
                         * The buffer is on the committing transaction's locked
@@ -1838,7 +1851,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                 * can remove it's next_transaction pointer from the
                 * running transaction if that is set, but nothing
                 * else. */
-               JBUFFER_TRACE(jh, "on committing transaction");
                set_buffer_freed(bh);
                if (jh->b_next_transaction) {
                        J_ASSERT(jh->b_next_transaction ==
@@ -1858,6 +1870,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                 * i_size already for this truncate so recovery will not
                 * expose the disk blocks we are discarding here.) */
                J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
+               JBUFFER_TRACE(jh, "on running transaction");
                may_free = __dispose_buffer(jh, transaction);
        }
 
index b6cf2be845a1473c43652fe1731e5870db7693d2..c051a94c8a979106a326cd3e3fb931095dc8305f 100644 (file)
@@ -967,6 +967,13 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
         */
        jbd_lock_bh_state(bh);
        spin_lock(&journal->j_list_lock);
+
+       /* Now that we have bh_state locked, are we really still mapped? */
+       if (!buffer_mapped(bh)) {
+               JBUFFER_TRACE(jh, "unmapped buffer, bailing out");
+               goto no_journal;
+       }
+
        if (jh->b_transaction) {
                JBUFFER_TRACE(jh, "has transaction");
                if (jh->b_transaction != handle->h_transaction) {
@@ -1028,6 +1035,11 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
                                sync_dirty_buffer(bh);
                                jbd_lock_bh_state(bh);
                                spin_lock(&journal->j_list_lock);
+                               /* Since we dropped the lock... */
+                               if (!buffer_mapped(bh)) {
+                                       JBUFFER_TRACE(jh, "buffer got unmapped");
+                                       goto no_journal;
+                               }
                                /* The buffer may become locked again at any
                                   time if it is redirtied */
                        }
@@ -1824,6 +1836,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                        }
                }
        } else if (transaction == journal->j_committing_transaction) {
+               JBUFFER_TRACE(jh, "on committing transaction");
                if (jh->b_jlist == BJ_Locked) {
                        /*
                         * The buffer is on the committing transaction's locked
@@ -1838,7 +1851,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                 * can remove it's next_transaction pointer from the
                 * running transaction if that is set, but nothing
                 * else. */
-               JBUFFER_TRACE(jh, "on committing transaction");
                set_buffer_freed(bh);
                if (jh->b_next_transaction) {
                        J_ASSERT(jh->b_next_transaction ==
@@ -1858,6 +1870,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                 * i_size already for this truncate so recovery will not
                 * expose the disk blocks we are discarding here.) */
                J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
+               JBUFFER_TRACE(jh, "on running transaction");
                may_free = __dispose_buffer(jh, transaction);
        }
 
index 49fb9f129938845589570d622803b9189ed172c4..8d705954d2946f9a4209107dde5412e651286f12 100644 (file)
@@ -74,7 +74,7 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe,
                wait_on_page_writeback(page);
 
                if (PagePrivate(page))
-                       try_to_release_page(page, mapping_gfp_mask(mapping));
+                       try_to_release_page(page, GFP_KERNEL);
 
                /*
                 * If we succeeded in removing the mapping, set LRU flag
@@ -333,7 +333,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
                                break;
 
                        error = add_to_page_cache_lru(page, mapping, index,
-                                             mapping_gfp_mask(mapping));
+                                             GFP_KERNEL);
                        if (unlikely(error)) {
                                page_cache_release(page);
                                if (error == -EEXIST)
@@ -557,7 +557,6 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
 {
        struct file *file = sd->file;
        struct address_space *mapping = file->f_mapping;
-       gfp_t gfp_mask = mapping_gfp_mask(mapping);
        unsigned int offset, this_len;
        struct page *page;
        pgoff_t index;
@@ -591,7 +590,7 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
                        goto find_page;
 
                page = buf->page;
-               if (add_to_page_cache(page, mapping, index, gfp_mask)) {
+               if (add_to_page_cache(page, mapping, index, GFP_KERNEL)) {
                        unlock_page(page);
                        goto find_page;
                }
@@ -613,7 +612,7 @@ find_page:
                         * This will also lock the page
                         */
                        ret = add_to_page_cache_lru(page, mapping, index,
-                                                   gfp_mask);
+                                                   GFP_KERNEL);
                        if (unlikely(ret))
                                goto out;
                }
index 9d0d11c180d958674922d37e2d36c757fcd6142a..9d873163a7ab09dfe605e2a2a49c5176f1b347e9 100644 (file)
 
 #define NOTES                                                          \
                .notes : { *(.note.*) } :note
+
+#define INITCALLS                                                      \
+       *(.initcall1.init)                                              \
+       *(.initcall1s.init)                                             \
+       *(.initcall2.init)                                              \
+       *(.initcall2s.init)                                             \
+       *(.initcall3.init)                                              \
+       *(.initcall3s.init)                                             \
+       *(.initcall4.init)                                              \
+       *(.initcall4s.init)                                             \
+       *(.initcall5.init)                                              \
+       *(.initcall5s.init)                                             \
+       *(.initcall6.init)                                              \
+       *(.initcall6s.init)                                             \
+       *(.initcall7.init)                                              \
+       *(.initcall7s.init)
+
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
deleted file mode 100644 (file)
index 21cd696..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* defines for inline arch setup functions */
-
-#include <asm/fixmap.h>
-#include <asm/i8259.h>
-#include "cobalt.h"
-
-static inline void do_timer_interrupt_hook(void)
-{
-       /* Clear the interrupt */
-       co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
-
-       do_timer(1);
-#ifndef CONFIG_SMP
-       update_process_times(user_mode_vm(irq_regs));
-#endif
-/*
- * In the SMP case we use the local APIC timer interrupt to do the
- * profiling, except when we simulate SMP mode on a uniprocessor
- * system, in that case we have to call the local interrupt handler.
- */
-#ifndef CONFIG_X86_LOCAL_APIC
-       profile_tick(CPU_PROFILING);
-#else
-       if (!using_apic_timer)
-               smp_local_timer_interrupt();
-#endif
-}
-
-static inline int do_timer_overflow(int count)
-{
-       int i;
-
-       spin_lock(&i8259A_lock);
-       /*
-        * This is tricky when I/O APICs are used;
-        * see do_timer_interrupt().
-        */
-       i = inb(0x20);
-       spin_unlock(&i8259A_lock);
-       
-       /* assumption about timer being IRQ0 */
-       if (i & 0x01) {
-               /*
-                * We cannot detect lost timer interrupts ... 
-                * well, that's why we call them lost, don't we? :)
-                * [hmm, on the Pentium and Alpha we can ... sort of]
-                */
-               count -= LATCH;
-       } else {
-               printk("do_slow_gettimeoffset(): hardware timer problem?\n");
-       }
-       return count;
-}
index de438c7147a8c3eb9c9805ee78418995d16b3490..18afe6b6fc4d35288ebdbd0be7dfad1091fb8a84 100644 (file)
@@ -51,6 +51,11 @@ static inline void clustered_apic_check(void)
 {
 }
 
+static inline int apicid_to_node(int logical_apicid)
+{
+       return 0;
+}
+
 /* Mapping from cpu number to logical apicid */
 static inline int cpu_to_logical_apicid(int cpu)
 {
index f4ebf96f5308ea0c50310bbff32745d626f69567..f1553196826f29d606c6651a1f6d27d1db5e957c 100644 (file)
@@ -196,7 +196,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
 #define BITS_TO_COMPAT_LONGS(bits) \
        (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
 
-long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
+long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
                       unsigned long bitmap_size);
 long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
                       unsigned long bitmap_size);
index e92b1455d7afd8c908bfc0722be018a09c46c226..ff40ea118e3a7798f2a3a092be3cc238788cbd2c 100644 (file)
@@ -84,19 +84,29 @@ extern void setup_arch(char **);
  * by link order. 
  * For backwards compatibility, initcall() puts the call in 
  * the device init subsection.
+ *
+ * The `id' arg to __define_initcall() is needed so that multiple initcalls
+ * can point at the same handler without causing duplicate-symbol build errors.
  */
 
-#define __define_initcall(level,fn) \
-       static initcall_t __initcall_##fn __attribute_used__ \
+#define __define_initcall(level,fn,id) \
+       static initcall_t __initcall_##fn##id __attribute_used__ \
        __attribute__((__section__(".initcall" level ".init"))) = fn
 
-#define core_initcall(fn)              __define_initcall("1",fn)
-#define postcore_initcall(fn)          __define_initcall("2",fn)
-#define arch_initcall(fn)              __define_initcall("3",fn)
-#define subsys_initcall(fn)            __define_initcall("4",fn)
-#define fs_initcall(fn)                        __define_initcall("5",fn)
-#define device_initcall(fn)            __define_initcall("6",fn)
-#define late_initcall(fn)              __define_initcall("7",fn)
+#define core_initcall(fn)              __define_initcall("1",fn,1)
+#define core_initcall_sync(fn)         __define_initcall("1s",fn,1s)
+#define postcore_initcall(fn)          __define_initcall("2",fn,2)
+#define postcore_initcall_sync(fn)     __define_initcall("2s",fn,2s)
+#define arch_initcall(fn)              __define_initcall("3",fn,3)
+#define arch_initcall_sync(fn)         __define_initcall("3s",fn,3s)
+#define subsys_initcall(fn)            __define_initcall("4",fn,4)
+#define subsys_initcall_sync(fn)       __define_initcall("4s",fn,4s)
+#define fs_initcall(fn)                        __define_initcall("5",fn,5)
+#define fs_initcall_sync(fn)           __define_initcall("5s",fn,5s)
+#define device_initcall(fn)            __define_initcall("6",fn,6)
+#define device_initcall_sync(fn)       __define_initcall("6s",fn,6s)
+#define late_initcall(fn)              __define_initcall("7",fn,7)
+#define late_initcall_sync(fn)         __define_initcall("7s",fn,7s)
 
 #define __initcall(fn) device_initcall(fn)
 
index ed0762b283a9fd725b08a10fd2e194f89fcba3c0..e06683e2bea39fb61fc02803aff1e5fcee2ce7fd 100644 (file)
@@ -218,13 +218,9 @@ struct zone {
         * under - it drives the swappiness decision: whether to unmap mapped
         * pages.
         *
-        * temp_priority is used to remember the scanning priority at which
-        * this zone was successfully refilled to free_pages == pages_high.
-        *
-        * Access to both these fields is quite racy even on uniprocessor.  But
+        * Access to both this field is quite racy even on uniprocessor.  But
         * it is expected to average out OK.
         */
-       int temp_priority;
        int prev_priority;
 
 
index 64f95092515120a517ba53c97a606c600a66e40c..c3e255bf859487aee64d3de7b5b34bf9d23e002a 100644 (file)
@@ -52,19 +52,23 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
 void release_pages(struct page **pages, int nr, int cold);
 
 #ifdef CONFIG_NUMA
-extern struct page *page_cache_alloc(struct address_space *x);
-extern struct page *page_cache_alloc_cold(struct address_space *x);
+extern struct page *__page_cache_alloc(gfp_t gfp);
 #else
+static inline struct page *__page_cache_alloc(gfp_t gfp)
+{
+       return alloc_pages(gfp, 0);
+}
+#endif
+
 static inline struct page *page_cache_alloc(struct address_space *x)
 {
-       return alloc_pages(mapping_gfp_mask(x), 0);
+       return __page_cache_alloc(mapping_gfp_mask(x));
 }
 
 static inline struct page *page_cache_alloc_cold(struct address_space *x)
 {
-       return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
+       return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD);
 }
-#endif
 
 typedef int filler_t(void *, struct page *);
 
index 6735c1cf334caba982d9a8dee39a9e70c8fe50de..eafe4a7b8237d902e31eef13aaacd212ea5b84f4 100644 (file)
@@ -466,7 +466,6 @@ struct signal_struct {
        struct pacct_struct pacct;      /* per-process accounting information */
 #endif
 #ifdef CONFIG_TASKSTATS
-       spinlock_t stats_lock;
        struct taskstats *stats;
 #endif
 };
index 16894b7edcc8e137dc7d58b0869f03f27710d5df..6562a2050a25a6c0d5762b338d80ea8e1c81d476 100644 (file)
@@ -23,25 +23,26 @@ static inline void taskstats_exit_free(struct taskstats *tidstats)
 
 static inline void taskstats_tgid_init(struct signal_struct *sig)
 {
-       spin_lock_init(&sig->stats_lock);
        sig->stats = NULL;
 }
 
-static inline void taskstats_tgid_alloc(struct signal_struct *sig)
+static inline void taskstats_tgid_alloc(struct task_struct *tsk)
 {
+       struct signal_struct *sig = tsk->signal;
        struct taskstats *stats;
-       unsigned long flags;
 
-       stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
-       if (!stats)
+       if (sig->stats != NULL)
                return;
 
-       spin_lock_irqsave(&sig->stats_lock, flags);
+       /* No problem if kmem_cache_zalloc() fails */
+       stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
+
+       spin_lock_irq(&tsk->sighand->siglock);
        if (!sig->stats) {
                sig->stats = stats;
                stats = NULL;
        }
-       spin_unlock_irqrestore(&sig->stats_lock, flags);
+       spin_unlock_irq(&tsk->sighand->siglock);
 
        if (stats)
                kmem_cache_free(taskstats_cache, stats);
@@ -49,23 +50,13 @@ static inline void taskstats_tgid_alloc(struct signal_struct *sig)
 
 static inline void taskstats_tgid_free(struct signal_struct *sig)
 {
-       struct taskstats *stats = NULL;
-       unsigned long flags;
-
-       spin_lock_irqsave(&sig->stats_lock, flags);
-       if (sig->stats) {
-               stats = sig->stats;
-               sig->stats = NULL;
-       }
-       spin_unlock_irqrestore(&sig->stats_lock, flags);
-       if (stats)
-               kmem_cache_free(taskstats_cache, stats);
+       if (sig->stats)
+               kmem_cache_free(taskstats_cache, sig->stats);
 }
 
 extern void taskstats_exit_alloc(struct taskstats **, unsigned int *);
 extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
 extern void taskstats_init_early(void);
-extern void taskstats_tgid_alloc(struct signal_struct *);
 #else
 static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu)
 {}
@@ -77,7 +68,7 @@ static inline void taskstats_exit_send(struct task_struct *tsk,
 {}
 static inline void taskstats_tgid_init(struct signal_struct *sig)
 {}
-static inline void taskstats_tgid_alloc(struct signal_struct *sig)
+static inline void taskstats_tgid_alloc(struct task_struct *tsk)
 {}
 static inline void taskstats_tgid_free(struct signal_struct *sig)
 {}
index ce5f1482e6be4fe2e90589be3822bfeb9da4242e..dc9a29d84abc85d1d79ae25a0bb976d527958a94 100644 (file)
@@ -60,7 +60,8 @@ extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
 extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
                                        unsigned long start, unsigned long end);
 extern struct vm_struct *get_vm_area_node(unsigned long size,
-                                       unsigned long flags, int node);
+                                         unsigned long flags, int node,
+                                         gfp_t gfp_mask);
 extern struct vm_struct *remove_vm_area(void *addr);
 extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
                        struct page ***pages);
index 75573e5d27b05c92dd1a11aaf483415935032624..d4898aad6cfa72ff46d78a8728c5d005531a338a 100644 (file)
@@ -678,7 +678,7 @@ int get_compat_sigevent(struct sigevent *event,
                ? -EFAULT : 0;
 }
 
-long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
+long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
                       unsigned long bitmap_size)
 {
        int i, j;
index 27dd3ee47099dd49c26790adf40b42efa1b950a3..663c920b2234c3c197e6fc76c276fdc1c791cdde 100644 (file)
@@ -150,18 +150,18 @@ static int _cpu_down(unsigned int cpu)
        p = __stop_machine_run(take_cpu_down, NULL, cpu);
        mutex_unlock(&cpu_bitmask_lock);
 
-       if (IS_ERR(p)) {
+       if (IS_ERR(p) || cpu_online(cpu)) {
                /* CPU didn't die: tell everyone.  Can't complain. */
                if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
                                (void *)(long)cpu) == NOTIFY_BAD)
                        BUG();
 
-               err = PTR_ERR(p);
-               goto out_allowed;
-       }
-
-       if (cpu_online(cpu))
+               if (IS_ERR(p)) {
+                       err = PTR_ERR(p);
+                       goto out_allowed;
+               }
                goto out_thread;
+       }
 
        /* Wait for it to sleep (leaving idle task). */
        while (!idle_cpu(cpu))
index f250a5e3e28151d293741a6604938d49c9336feb..06de6c4e8ca3a66937ce8763d33ca42852fbb698 100644 (file)
@@ -128,6 +128,7 @@ static void __exit_signal(struct task_struct *tsk)
        flush_sigqueue(&tsk->pending);
        if (sig) {
                flush_sigqueue(&sig->shared_pending);
+               taskstats_tgid_free(sig);
                __cleanup_signal(sig);
        }
 }
index 29ebb30850eda41f743cdacb6d7bb0f696872a87..3da978eec791216dd796cd704aed67b263713fa1 100644 (file)
@@ -830,7 +830,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
        if (clone_flags & CLONE_THREAD) {
                atomic_inc(&current->signal->count);
                atomic_inc(&current->signal->live);
-               taskstats_tgid_alloc(current->signal);
+               taskstats_tgid_alloc(current);
                return 0;
        }
        sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
@@ -897,7 +897,6 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
 void __cleanup_signal(struct signal_struct *sig)
 {
        exit_thread_group_keys(sig);
-       taskstats_tgid_free(sig);
        kmem_cache_free(signal_cachep, sig);
 }
 
index 67009bd56c522b634d35a9b8c2852228b4b29730..5072a943fe3571eb0465aea4418348e55f46549d 100644 (file)
@@ -1342,7 +1342,7 @@ static void set_license(struct module *mod, const char *license)
 
        if (!license_is_gpl_compatible(license)) {
                if (!(tainted & TAINT_PROPRIETARY_MODULE))
-                       printk(KERN_WARNING "%s: module license '%s' taints"
+                       printk(KERN_WARNING "%s: module license '%s' taints "
                                "kernel.\n", mod->name, license);
                add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
        }
index 5d6a8c54ee85f56f9a3640480d5560ed35f2b4e5..8adfb8069c6d52be1893b8bd26175d7da9aac838 100644 (file)
@@ -174,21 +174,19 @@ static void send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
        up_write(&listeners->sem);
 }
 
-static int fill_pid(pid_t pid, struct task_struct *pidtsk,
+static int fill_pid(pid_t pid, struct task_struct *tsk,
                struct taskstats *stats)
 {
        int rc = 0;
-       struct task_struct *tsk = pidtsk;
 
-       if (!pidtsk) {
-               read_lock(&tasklist_lock);
+       if (!tsk) {
+               rcu_read_lock();
                tsk = find_task_by_pid(pid);
-               if (!tsk) {
-                       read_unlock(&tasklist_lock);
+               if (tsk)
+                       get_task_struct(tsk);
+               rcu_read_unlock();
+               if (!tsk)
                        return -ESRCH;
-               }
-               get_task_struct(tsk);
-               read_unlock(&tasklist_lock);
        } else
                get_task_struct(tsk);
 
@@ -214,39 +212,30 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk,
 
 }
 
-static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk,
+static int fill_tgid(pid_t tgid, struct task_struct *first,
                struct taskstats *stats)
 {
-       struct task_struct *tsk, *first;
+       struct task_struct *tsk;
        unsigned long flags;
+       int rc = -ESRCH;
 
        /*
         * Add additional stats from live tasks except zombie thread group
         * leaders who are already counted with the dead tasks
         */
-       first = tgidtsk;
-       if (!first) {
-               read_lock(&tasklist_lock);
+       rcu_read_lock();
+       if (!first)
                first = find_task_by_pid(tgid);
-               if (!first) {
-                       read_unlock(&tasklist_lock);
-                       return -ESRCH;
-               }
-               get_task_struct(first);
-               read_unlock(&tasklist_lock);
-       } else
-               get_task_struct(first);
 
-       /* Start with stats from dead tasks */
-       spin_lock_irqsave(&first->signal->stats_lock, flags);
+       if (!first || !lock_task_sighand(first, &flags))
+               goto out;
+
        if (first->signal->stats)
                memcpy(stats, first->signal->stats, sizeof(*stats));
-       spin_unlock_irqrestore(&first->signal->stats_lock, flags);
 
        tsk = first;
-       read_lock(&tasklist_lock);
        do {
-               if (tsk->exit_state == EXIT_ZOMBIE && thread_group_leader(tsk))
+               if (tsk->exit_state)
                        continue;
                /*
                 * Accounting subsystem can call its functions here to
@@ -257,15 +246,18 @@ static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk,
                delayacct_add_tsk(stats, tsk);
 
        } while_each_thread(first, tsk);
-       read_unlock(&tasklist_lock);
-       stats->version = TASKSTATS_VERSION;
 
+       unlock_task_sighand(first, &flags);
+       rc = 0;
+out:
+       rcu_read_unlock();
+
+       stats->version = TASKSTATS_VERSION;
        /*
         * Accounting subsytems can also add calls here to modify
         * fields of taskstats.
         */
-
-       return 0;
+       return rc;
 }
 
 
@@ -273,7 +265,7 @@ static void fill_tgid_exit(struct task_struct *tsk)
 {
        unsigned long flags;
 
-       spin_lock_irqsave(&tsk->signal->stats_lock, flags);
+       spin_lock_irqsave(&tsk->sighand->siglock, flags);
        if (!tsk->signal->stats)
                goto ret;
 
@@ -285,7 +277,7 @@ static void fill_tgid_exit(struct task_struct *tsk)
         */
        delayacct_add_tsk(tsk->signal->stats, tsk);
 ret:
-       spin_unlock_irqrestore(&tsk->signal->stats_lock, flags);
+       spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
        return;
 }
 
@@ -461,15 +453,10 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
        size_t size;
        int is_thread_group;
        struct nlattr *na;
-       unsigned long flags;
 
        if (!family_registered || !tidstats)
                return;
 
-       spin_lock_irqsave(&tsk->signal->stats_lock, flags);
-       is_thread_group = tsk->signal->stats ? 1 : 0;
-       spin_unlock_irqrestore(&tsk->signal->stats_lock, flags);
-
        rc = 0;
        /*
         * Size includes space for nested attributes
@@ -477,6 +464,7 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
        size = nla_total_size(sizeof(u32)) +
                nla_total_size(sizeof(struct taskstats)) + nla_total_size(0);
 
+       is_thread_group = (tsk->signal->stats != NULL);
        if (is_thread_group)
                size = 2 * size;        /* PID + STATS + TGID + STATS */
 
index 47195fa0ec4f29b09ba7a2294b8863e829b089d7..3afeaa3a73f998dd422e1518c6c4256749207538 100644 (file)
@@ -161,9 +161,9 @@ void second_overflow(void)
                        time_adjust += MAX_TICKADJ;
                        tick_length -= MAX_TICKADJ_SCALED;
                } else {
-                       time_adjust = 0;
                        tick_length += (s64)(time_adjust * NSEC_PER_USEC /
                                             HZ) << TICK_LENGTH_SHIFT;
+                       time_adjust = 0;
                }
        }
 }
index db443221ba5ba0038ee3bd40270f6b5a2a8922b7..65a5036a3d9519031526f499c5495ac23401a90e 100644 (file)
@@ -36,7 +36,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
 
        /* calculate task elapsed time in timespec */
        do_posix_clock_monotonic_gettime(&uptime);
-       ts = timespec_sub(uptime, current->group_leader->start_time);
+       ts = timespec_sub(uptime, tsk->start_time);
        /* rebase elapsed time to usec */
        ac_etime = timespec_to_ns(&ts);
        do_div(ac_etime, NSEC_PER_USEC);
@@ -58,7 +58,10 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
        stats->ac_uid    = tsk->uid;
        stats->ac_gid    = tsk->gid;
        stats->ac_pid    = tsk->pid;
-       stats->ac_ppid   = (tsk->parent) ? tsk->parent->pid : 0;
+       rcu_read_lock();
+       stats->ac_ppid   = pid_alive(tsk) ?
+                               rcu_dereference(tsk->real_parent)->tgid : 0;
+       rcu_read_unlock();
        stats->ac_utime  = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC;
        stats->ac_stime  = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC;
        stats->ac_minflt = tsk->min_flt;
index 3df9bfc7ff78fed6215a2d6f138a18a016d7e04a..17c2f03d2c27f9928cf175db8b01a929426d130c 100644 (file)
@@ -99,7 +99,7 @@ static void __queue_work(struct cpu_workqueue_struct *cwq,
  * @wq: workqueue to use
  * @work: work to queue
  *
- * Returns non-zero if it was successfully added.
+ * Returns 0 if @work was already on a queue, non-zero otherwise.
  *
  * We queue the work to the CPU it was submitted, but there is no
  * guarantee that it will be processed by that CPU.
@@ -138,7 +138,7 @@ static void delayed_work_timer_fn(unsigned long __data)
  * @work: work to queue
  * @delay: number of jiffies to wait before queueing
  *
- * Returns non-zero if it was successfully added.
+ * Returns 0 if @work was already on a queue, non-zero otherwise.
  */
 int fastcall queue_delayed_work(struct workqueue_struct *wq,
                        struct work_struct *work, unsigned long delay)
@@ -169,7 +169,7 @@ EXPORT_SYMBOL_GPL(queue_delayed_work);
  * @work: work to queue
  * @delay: number of jiffies to wait before queueing
  *
- * Returns non-zero if it was successfully added.
+ * Returns 0 if @work was already on a queue, non-zero otherwise.
  */
 int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
                        struct work_struct *work, unsigned long delay)
index 63077267367ea08d7770e59a9e6e6b23bb4725e7..a485d75962af5f7a6bbb4f819aa780c812fe25ca 100644 (file)
@@ -320,7 +320,7 @@ char *strstrip(char *s)
                return s;
 
        end = s + size - 1;
-       while (end != s && isspace(*end))
+       while (end >= s && isspace(*end))
                end--;
        *(end + 1) = '\0';
 
index cb26e33fd0ff15cc9932ec44592c7ae7174ac0b7..7b84dc814347544d68ab662f11691b25ca54ac3a 100644 (file)
@@ -467,25 +467,15 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
 }
 
 #ifdef CONFIG_NUMA
-struct page *page_cache_alloc(struct address_space *x)
+struct page *__page_cache_alloc(gfp_t gfp)
 {
        if (cpuset_do_page_mem_spread()) {
                int n = cpuset_mem_spread_node();
-               return alloc_pages_node(n, mapping_gfp_mask(x), 0);
+               return alloc_pages_node(n, gfp, 0);
        }
-       return alloc_pages(mapping_gfp_mask(x), 0);
+       return alloc_pages(gfp, 0);
 }
-EXPORT_SYMBOL(page_cache_alloc);
-
-struct page *page_cache_alloc_cold(struct address_space *x)
-{
-       if (cpuset_do_page_mem_spread()) {
-               int n = cpuset_mem_spread_node();
-               return alloc_pages_node(n, mapping_gfp_mask(x)|__GFP_COLD, 0);
-       }
-       return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
-}
-EXPORT_SYMBOL(page_cache_alloc_cold);
+EXPORT_SYMBOL(__page_cache_alloc);
 #endif
 
 static int __sleep_on_page_lock(void *word)
@@ -826,7 +816,6 @@ struct page *
 grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
 {
        struct page *page = find_get_page(mapping, index);
-       gfp_t gfp_mask;
 
        if (page) {
                if (!TestSetPageLocked(page))
@@ -834,9 +823,8 @@ grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
                page_cache_release(page);
                return NULL;
        }
-       gfp_mask = mapping_gfp_mask(mapping) & ~__GFP_FS;
-       page = alloc_pages(gfp_mask, 0);
-       if (page && add_to_page_cache_lru(page, mapping, index, gfp_mask)) {
+       page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS);
+       if (page && add_to_page_cache_lru(page, mapping, index, GFP_KERNEL)) {
                page_cache_release(page);
                page = NULL;
        }
index 2dbec90dc3bad98cab038db4513f566360e8de8d..a088f593a807532aa9b37307a04b5427becfd449 100644 (file)
@@ -478,6 +478,9 @@ int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
 retry:
        page = find_lock_page(mapping, idx);
        if (!page) {
+               size = i_size_read(mapping->host) >> HPAGE_SHIFT;
+               if (idx >= size)
+                       goto out;
                if (hugetlb_get_quota(mapping))
                        goto out;
                page = alloc_huge_page(vma, address);
index f5fc45472d5ca77d3406b9ced195c45fde97ca78..b55bb358b832975265043df8375dc523c2b3d807 100644 (file)
@@ -2261,7 +2261,7 @@ unsigned long __init __absent_pages_in_range(int nid,
 
        /* Account for ranges past physical memory on this node */
        if (range_end_pfn > prev_end_pfn)
-               hole_pages = range_end_pfn -
+               hole_pages += range_end_pfn -
                                max(range_start_pfn, prev_end_pfn);
 
        return hole_pages;
@@ -2407,7 +2407,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
                zone->zone_pgdat = pgdat;
                zone->free_pages = 0;
 
-               zone->temp_priority = zone->prev_priority = DEF_PRIORITY;
+               zone->prev_priority = DEF_PRIORITY;
 
                zone_pcp_init(zone);
                INIT_LIST_HEAD(&zone->active_list);
index 86c52ab80878f1df2239ae9270c5f49b643ab1b0..b3c82ba300124ea28d1cb952f337e387b1c4b9eb 100644 (file)
@@ -211,7 +211,7 @@ static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
        struct page *page, *ret;
        unsigned long memmap_size = sizeof(struct page) * nr_pages;
 
-       page = alloc_pages(GFP_KERNEL, get_order(memmap_size));
+       page = alloc_pages(GFP_KERNEL|__GFP_NOWARN, get_order(memmap_size));
        if (page)
                goto got_map_page;
 
index 1133dd3aafcf4c02e5b2d109b02f45013b7d9d11..6d381df7c9b39758f5c978a3de8383963ec06afc 100644 (file)
@@ -160,13 +160,15 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
        return err;
 }
 
-struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
-                               unsigned long start, unsigned long end, int node)
+static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
+                                           unsigned long start, unsigned long end,
+                                           int node, gfp_t gfp_mask)
 {
        struct vm_struct **p, *tmp, *area;
        unsigned long align = 1;
        unsigned long addr;
 
+       BUG_ON(in_interrupt());
        if (flags & VM_IOREMAP) {
                int bit = fls(size);
 
@@ -180,7 +182,7 @@ struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
        addr = ALIGN(start, align);
        size = PAGE_ALIGN(size);
 
-       area = kmalloc_node(sizeof(*area), GFP_KERNEL, node);
+       area = kmalloc_node(sizeof(*area), gfp_mask, node);
        if (unlikely(!area))
                return NULL;
 
@@ -236,7 +238,7 @@ out:
 struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
                                unsigned long start, unsigned long end)
 {
-       return __get_vm_area_node(size, flags, start, end, -1);
+       return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL);
 }
 
 /**
@@ -253,9 +255,11 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
        return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END);
 }
 
-struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags, int node)
+struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags,
+                                  int node, gfp_t gfp_mask)
 {
-       return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node);
+       return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node,
+                                 gfp_mask);
 }
 
 /* Caller must hold vmlist_lock */
@@ -487,7 +491,7 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
        if (!size || (size >> PAGE_SHIFT) > num_physpages)
                return NULL;
 
-       area = get_vm_area_node(size, VM_ALLOC, node);
+       area = get_vm_area_node(size, VM_ALLOC, node, gfp_mask);
        if (!area)
                return NULL;
 
index f05527bf792b1e28b78d3a45cf2244efb4b34cf2..518540a4a2a66a1ade20312d1d655ba6923e05b5 100644 (file)
@@ -723,6 +723,20 @@ done:
        return nr_reclaimed;
 }
 
+/*
+ * We are about to scan this zone at a certain priority level.  If that priority
+ * level is smaller (ie: more urgent) than the previous priority, then note
+ * that priority level within the zone.  This is done so that when the next
+ * process comes in to scan this zone, it will immediately start out at this
+ * priority level rather than having to build up its own scanning priority.
+ * Here, this priority affects only the reclaim-mapped threshold.
+ */
+static inline void note_zone_scanning_priority(struct zone *zone, int priority)
+{
+       if (priority < zone->prev_priority)
+               zone->prev_priority = priority;
+}
+
 static inline int zone_is_near_oom(struct zone *zone)
 {
        return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3;
@@ -746,7 +760,7 @@ static inline int zone_is_near_oom(struct zone *zone)
  * But we had to alter page->flags anyway.
  */
 static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
-                               struct scan_control *sc)
+                               struct scan_control *sc, int priority)
 {
        unsigned long pgmoved;
        int pgdeactivate = 0;
@@ -770,7 +784,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
                 * `distress' is a measure of how much trouble we're having
                 * reclaiming pages.  0 -> no problems.  100 -> great trouble.
                 */
-               distress = 100 >> zone->prev_priority;
+               distress = 100 >> min(zone->prev_priority, priority);
 
                /*
                 * The point of this algorithm is to decide when to start
@@ -922,7 +936,7 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
                        nr_to_scan = min(nr_active,
                                        (unsigned long)sc->swap_cluster_max);
                        nr_active -= nr_to_scan;
-                       shrink_active_list(nr_to_scan, zone, sc);
+                       shrink_active_list(nr_to_scan, zone, sc, priority);
                }
 
                if (nr_inactive) {
@@ -972,9 +986,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
                if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
                        continue;
 
-               zone->temp_priority = priority;
-               if (zone->prev_priority > priority)
-                       zone->prev_priority = priority;
+               note_zone_scanning_priority(zone, priority);
 
                if (zone->all_unreclaimable && priority != DEF_PRIORITY)
                        continue;       /* Let kswapd poll it */
@@ -1024,7 +1036,6 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
                if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
                        continue;
 
-               zone->temp_priority = DEF_PRIORITY;
                lru_pages += zone->nr_active + zone->nr_inactive;
        }
 
@@ -1065,13 +1076,22 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
        if (!sc.all_unreclaimable)
                ret = 1;
 out:
+       /*
+        * Now that we've scanned all the zones at this priority level, note
+        * that level within the zone so that the next thread which performs
+        * scanning of this zone will immediately start out at this priority
+        * level.  This affects only the decision whether or not to bring
+        * mapped pages onto the inactive list.
+        */
+       if (priority < 0)
+               priority = 0;
        for (i = 0; zones[i] != 0; i++) {
                struct zone *zone = zones[i];
 
                if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
                        continue;
 
-               zone->prev_priority = zone->temp_priority;
+               zone->prev_priority = priority;
        }
        return ret;
 }
@@ -1111,6 +1131,11 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
                .swap_cluster_max = SWAP_CLUSTER_MAX,
                .swappiness = vm_swappiness,
        };
+       /*
+        * temp_priority is used to remember the scanning priority at which
+        * this zone was successfully refilled to free_pages == pages_high.
+        */
+       int temp_priority[MAX_NR_ZONES];
 
 loop_again:
        total_scanned = 0;
@@ -1118,11 +1143,8 @@ loop_again:
        sc.may_writepage = !laptop_mode;
        count_vm_event(PAGEOUTRUN);
 
-       for (i = 0; i < pgdat->nr_zones; i++) {
-               struct zone *zone = pgdat->node_zones + i;
-
-               zone->temp_priority = DEF_PRIORITY;
-       }
+       for (i = 0; i < pgdat->nr_zones; i++)
+               temp_priority[i] = DEF_PRIORITY;
 
        for (priority = DEF_PRIORITY; priority >= 0; priority--) {
                int end_zone = 0;       /* Inclusive.  0 = ZONE_DMA */
@@ -1183,10 +1205,9 @@ scan:
                        if (!zone_watermark_ok(zone, order, zone->pages_high,
                                               end_zone, 0))
                                all_zones_ok = 0;
-                       zone->temp_priority = priority;
-                       if (zone->prev_priority > priority)
-                               zone->prev_priority = priority;
+                       temp_priority[i] = priority;
                        sc.nr_scanned = 0;
+                       note_zone_scanning_priority(zone, priority);
                        nr_reclaimed += shrink_zone(priority, zone, &sc);
                        reclaim_state->reclaimed_slab = 0;
                        nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
@@ -1226,10 +1247,15 @@ scan:
                        break;
        }
 out:
+       /*
+        * Note within each zone the priority level at which this zone was
+        * brought into a happy state.  So that the next thread which scans this
+        * zone will start out at that priority level.
+        */
        for (i = 0; i < pgdat->nr_zones; i++) {
                struct zone *zone = pgdat->node_zones + i;
 
-               zone->prev_priority = zone->temp_priority;
+               zone->prev_priority = temp_priority[i];
        }
        if (!all_zones_ok) {
                cond_resched();
@@ -1358,7 +1384,7 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int pass,
                        if (zone->nr_scan_active >= nr_pages || pass > 3) {
                                zone->nr_scan_active = 0;
                                nr_to_scan = min(nr_pages, zone->nr_active);
-                               shrink_active_list(nr_to_scan, zone, sc);
+                               shrink_active_list(nr_to_scan, zone, sc, prio);
                        }
                }
 
@@ -1614,6 +1640,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
                 */
                priority = ZONE_RECLAIM_PRIORITY;
                do {
+                       note_zone_scanning_priority(zone, priority);
                        nr_reclaimed += shrink_zone(priority, zone, &sc);
                        priority--;
                } while (priority >= 0 && nr_reclaimed < nr_pages);
index 45b124e012f5fe8c7c8274dfd3f8f0861ce58aaa..8614e8f6743b599c3761d6d2ca30f0012048676e 100644 (file)
@@ -587,11 +587,9 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
                seq_printf(m,
                           "\n  all_unreclaimable: %u"
                           "\n  prev_priority:     %i"
-                          "\n  temp_priority:     %i"
                           "\n  start_pfn:         %lu",
                           zone->all_unreclaimable,
                           zone->prev_priority,
-                          zone->temp_priority,
                           zone->zone_start_pfn);
                spin_unlock_irqrestore(&zone->lock, flags);
                seq_putc(m, '\n');