]> Pileus Git - ~andy/linux/commitdiff
powerpc/eeh: Use slab to allocate eeh devices
authorGavin Shan <shangw@linux.vnet.ibm.com>
Fri, 7 Sep 2012 22:44:03 +0000 (22:44 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 9 Sep 2012 23:35:28 +0000 (09:35 +1000)
The EEH initialization functions have been postponed until slab/slub
are ready. So we use slab/slub to allocate the memory chunks for newly
creatd EEH devices. That would save lots of memory.

The patch also does cleanup to replace "kmalloc" with "kzalloc" so
that we needn't clear the allocated memory chunk explicitly.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/eeh_cache.c
arch/powerpc/platforms/pseries/eeh_dev.c
arch/powerpc/platforms/pseries/eeh_event.c

index e5ae1c687c669e27e1f03c6007295e53e750eff6..f50b717286fbb8e96bc8ca85a5bbbb0e7eef119a 100644 (file)
@@ -151,7 +151,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
                        return piar;
                }
        }
-       piar = kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
+       piar = kzalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
        if (!piar)
                return NULL;
 
index ab68c5910f9f0c6af856b1990dd5abb38aca795a..8e3443b260e4777428bb7bccbb8d1765147fb82f 100644 (file)
@@ -55,7 +55,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
        struct eeh_dev *edev;
 
        /* Allocate EEH device */
-       edev = zalloc_maybe_bootmem(sizeof(*edev), GFP_KERNEL);
+       edev = kzalloc(sizeof(*edev), GFP_KERNEL);
        if (!edev) {
                pr_warning("%s: out of memory\n", __func__);
                return NULL;
index fb506317ebb09141716d0d9bfe068fe7f953221d..61327722b4fcf4db72fd187954c4ef4ebb65f7a7 100644 (file)
@@ -139,7 +139,7 @@ int eeh_send_failure_event(struct eeh_dev *edev)
                printk(KERN_ERR "EEH: PCI location = %s\n", location);
                return 1;
        }
-       event = kmalloc(sizeof(*event), GFP_ATOMIC);
+       event = kzalloc(sizeof(*event), GFP_ATOMIC);
        if (event == NULL) {
                printk(KERN_ERR "EEH: out of memory, event not handled\n");
                return 1;