From c59def9f222d44bb7e2f0a559f2906191a0862d7 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 16 May 2007 22:10:50 -0700 Subject: Slab allocators: Drop support for destructors There is no user of destructors left. There is no reason why we should keep checking for destructors calls in the slab allocators. The RFC for this patch was discussed at http://marc.info/?l=linux-kernel&m=117882364330705&w=2 Destructors were mainly used for list management which required them to take a spinlock. Taking a spinlock in a destructor is a bit risky since the slab allocators may run the destructors anytime they decide a slab is no longer needed. Patch drops destructor support. Any attempt to use a destructor will BUG(). Acked-by: Pekka Enberg Acked-by: Paul Mundt Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/slub_def.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index c6c1f4a120e..5e2e7297dfa 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -40,7 +40,6 @@ struct kmem_cache { int objects; /* Number of objects in slab */ int refcount; /* Refcount for slab cache destroy */ void (*ctor)(void *, struct kmem_cache *, unsigned long); - void (*dtor)(void *, struct kmem_cache *, unsigned long); int inuse; /* Offset to metadata */ int align; /* Alignment */ const char *name; /* Name (only for display!) */ -- cgit v1.2.3 From 3ca12ee549f7837b8a685dddc9515f9fc28434ee Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 16 May 2007 22:10:52 -0700 Subject: SLAB: Move two remaining SLAB specific definitions to slab_def.h Two definitions remained in slab.h that are particular to the SLAB allocator. Move to slab_def.h Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/slab.h | 3 --- include/linux/slab_def.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/slab.h b/include/linux/slab.h index 71829efc40b..5dbc0bae26e 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -233,9 +233,6 @@ extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *); #endif /* DEBUG_SLAB */ -extern const struct seq_operations slabinfo_op; -ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); - #endif /* __KERNEL__ */ #endif /* _LINUX_SLAB_H */ diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 5e4364644ed..8d81a60518e 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h @@ -109,4 +109,7 @@ found: #endif /* CONFIG_NUMA */ +extern const struct seq_operations slabinfo_op; +ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); + #endif /* _LINUX_SLAB_DEF_H */ -- cgit v1.2.3 From ade3aff25fb2dce76e2a9b53e1334bd0a174f739 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 16 May 2007 22:10:54 -0700 Subject: slub: fix handling of oversized slabs I'm getting zillions of undefined references to __kmalloc_size_too_large on alpha. For some reason alpha is building out-of-line copies of kmalloc_slab() into lots of compilation units. It turns out that gcc just isn't smart enough to work out that __builtin_contant_p(size)==true implies that __builtin_contant_p(index)==true. So let's give it a bit of help. Cc: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/slub_def.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 5e2e7297dfa..a9fb92862aa 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -145,7 +145,12 @@ static inline struct kmem_cache *kmalloc_slab(size_t size) if (index == 0) return NULL; - if (index < 0) { + /* + * This function only gets expanded if __builtin_constant_p(size), so + * testing it here shouldn't be needed. But some versions of gcc need + * help. + */ + if (__builtin_constant_p(size) && index < 0) { /* * Generate a link failure. Would be great if we could * do something to stop the compile here. -- cgit v1.2.3 From a35afb830f8d71ec211531aeb9a621b09a2efb39 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 16 May 2007 22:10:57 -0700 Subject: Remove SLAB_CTOR_CONSTRUCTOR SLAB_CTOR_CONSTRUCTOR is always specified. No point in checking it. Signed-off-by: Christoph Lameter Cc: David Howells Cc: Jens Axboe Cc: Steven French Cc: Michael Halcrow Cc: OGAWA Hirofumi Cc: Miklos Szeredi Cc: Steven Whitehouse Cc: Roman Zippel Cc: David Woodhouse Cc: Dave Kleikamp Cc: Trond Myklebust Cc: "J. Bruce Fields" Cc: Anton Altaparmakov Cc: Mark Fasheh Cc: Paul Mackerras Cc: Christoph Hellwig Cc: Jan Kara Cc: David Chinner Cc: "David S. Miller" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/slab.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/slab.h b/include/linux/slab.h index 5dbc0bae26e..6fb2ae21415 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -32,9 +32,6 @@ typedef struct kmem_cache kmem_cache_t __deprecated; #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ -/* Flags passed to a constructor functions */ -#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* If not set, then deconstructor */ - /* * struct kmem_cache related prototypes */ -- cgit v1.2.3 From 0aa817f078b655d0ae36669169d73a5c8a388016 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 16 May 2007 22:11:01 -0700 Subject: Slab allocators: define common size limitations Currently we have a maze of configuration variables that determine the maximum slab size. Worst of all it seems to vary between SLAB and SLUB. So define a common maximum size for kmalloc. For conveniences sake we use the maximum size ever supported which is 32 MB. We limit the maximum size to a lower limit if MAX_ORDER does not allow such large allocations. For many architectures this patch will have the effect of adding large kmalloc sizes. x86_64 adds 5 new kmalloc sizes. So a small amount of memory will be needed for these caches (contemporary SLAB has dynamically sizeable node and cpu structure so the waste is less than in the past) Most architectures will then be able to allocate object with sizes up to MAX_ORDER. We have had repeated breakage (in fact whenever we doubled the number of supported processors) on IA64 because one or the other struct grew beyond what the slab allocators supported. This will avoid future issues and f.e. avoid fixes for 2k and 4k cpu support. CONFIG_LARGE_ALLOCS is no longer necessary so drop it. It fixes sparc64 with SLAB. Signed-off-by: Christoph Lameter Signed-off-by: "David S. Miller" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/kmalloc_sizes.h | 20 +++++++++++++++----- include/linux/slab.h | 15 +++++++++++++++ include/linux/slub_def.h | 19 ++----------------- 3 files changed, 32 insertions(+), 22 deletions(-) (limited to 'include') diff --git a/include/linux/kmalloc_sizes.h b/include/linux/kmalloc_sizes.h index bda23e00ed7..e576b848ce1 100644 --- a/include/linux/kmalloc_sizes.h +++ b/include/linux/kmalloc_sizes.h @@ -19,17 +19,27 @@ CACHE(32768) CACHE(65536) CACHE(131072) -#if (NR_CPUS > 512) || (MAX_NUMNODES > 256) || !defined(CONFIG_MMU) +#if KMALLOC_MAX_SIZE >= 262144 CACHE(262144) #endif -#ifndef CONFIG_MMU +#if KMALLOC_MAX_SIZE >= 524288 CACHE(524288) +#endif +#if KMALLOC_MAX_SIZE >= 1048576 CACHE(1048576) -#ifdef CONFIG_LARGE_ALLOCS +#endif +#if KMALLOC_MAX_SIZE >= 2097152 CACHE(2097152) +#endif +#if KMALLOC_MAX_SIZE >= 4194304 CACHE(4194304) +#endif +#if KMALLOC_MAX_SIZE >= 8388608 CACHE(8388608) +#endif +#if KMALLOC_MAX_SIZE >= 16777216 CACHE(16777216) +#endif +#if KMALLOC_MAX_SIZE >= 33554432 CACHE(33554432) -#endif /* CONFIG_LARGE_ALLOCS */ -#endif /* CONFIG_MMU */ +#endif diff --git a/include/linux/slab.h b/include/linux/slab.h index 6fb2ae21415..a015236cc57 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -73,6 +73,21 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep, } #endif +/* + * The largest kmalloc size supported by the slab allocators is + * 32 megabyte (2^25) or the maximum allocatable page order if that is + * less than 32 MB. + * + * WARNING: Its not easy to increase this value since the allocators have + * to do various tricks to work around compiler limitations in order to + * ensure proper constant folding. + */ +#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT) <= 25 ? \ + (MAX_ORDER + PAGE_SHIFT) : 25) + +#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH) +#define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT) + /* * Common kmalloc functions provided by all allocators */ diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index a9fb92862aa..0764c829d96 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -58,17 +58,6 @@ struct kmem_cache { */ #define KMALLOC_SHIFT_LOW 3 -#ifdef CONFIG_LARGE_ALLOCS -#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT) =< 25 ? \ - (MAX_ORDER + PAGE_SHIFT - 1) : 25) -#else -#if !defined(CONFIG_MMU) || NR_CPUS > 512 || MAX_NUMNODES > 256 -#define KMALLOC_SHIFT_HIGH 20 -#else -#define KMALLOC_SHIFT_HIGH 18 -#endif -#endif - /* * We keep the general caches in an array of slab caches that are used for * 2^x bytes of allocations. @@ -79,7 +68,7 @@ extern struct kmem_cache kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; * Sorry that the following has to be that ugly but some versions of GCC * have trouble with constant propagation and loops. */ -static inline int kmalloc_index(int size) +static inline int kmalloc_index(size_t size) { /* * We should return 0 if size == 0 but we use the smallest object @@ -87,7 +76,7 @@ static inline int kmalloc_index(int size) */ WARN_ON_ONCE(size == 0); - if (size > (1 << KMALLOC_SHIFT_HIGH)) + if (size > KMALLOC_MAX_SIZE) return -1; if (size > 64 && size <= 96) @@ -110,17 +99,13 @@ static inline int kmalloc_index(int size) if (size <= 64 * 1024) return 16; if (size <= 128 * 1024) return 17; if (size <= 256 * 1024) return 18; -#if KMALLOC_SHIFT_HIGH > 18 if (size <= 512 * 1024) return 19; if (size <= 1024 * 1024) return 20; -#endif -#if KMALLOC_SHIFT_HIGH > 20 if (size <= 2 * 1024 * 1024) return 21; if (size <= 4 * 1024 * 1024) return 22; if (size <= 8 * 1024 * 1024) return 23; if (size <= 16 * 1024 * 1024) return 24; if (size <= 32 * 1024 * 1024) return 25; -#endif return -1; /* -- cgit v1.2.3 From f363d16fbb9374c0bd7f2757d412c287169094c9 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 16 May 2007 22:11:06 -0700 Subject: acpi: fix potential call to a freed memory section. Strip __cpuinit[data] from Node <-> PXM routines and supporting data structures. Also make pxm_to_node_map and node_to_pxm_map local to the numa acpi module. This fixes a bug triggered by the following conditions: - boot on a machine with a SLIT table defined - kernel is configured w/ CONFIG_HOTPLUG_CPU=n - cat /sys/devices/system/node/node*/distance This will cause an oops by calling into a freed memory section. In particular, on x86_64, __node_distance calls node_to_pxm(). Signed-off-by: Aaron Durbin Cc: Len Brown Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/acpi/acpi_numa.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h index f9d2bde9a7b..b62cd36ff32 100644 --- a/include/acpi/acpi_numa.h +++ b/include/acpi/acpi_numa.h @@ -11,11 +11,8 @@ #define MAX_PXM_DOMAINS (256) /* Old pxm spec is defined 8 bit */ #endif -extern int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS]; -extern int __cpuinitdata node_to_pxm_map[MAX_NUMNODES]; - -extern int __cpuinit pxm_to_node(int); -extern int __cpuinit node_to_pxm(int); +extern int pxm_to_node(int); +extern int node_to_pxm(int); extern int __cpuinit acpi_map_pxm_to_node(int); extern void __cpuinit acpi_unmap_pxm_to_node(int); -- cgit v1.2.3 From 79974a0e4c6be6e9a3717b4c5a5d5c44c36b1653 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Wed, 16 May 2007 22:11:09 -0700 Subject: Let smp_call_function_single return -EBUSY on UP All architectures that have an implementation of smp_call_function_single let it return -EBUSY if it is asked to execute func on the current cpu. (akpm: except for x86_64). Therefore the UP version must always return -EBUSY. [akpm@linux-foundation.org: build fix] Signed-off-by: Heiko Carstens Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/smp.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/smp.h b/include/linux/smp.h index 3f70149eabb..96ac21f8dd7 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -6,6 +6,7 @@ * Alan Cox. */ +#include extern void cpu_idle(void); @@ -99,11 +100,9 @@ static inline void smp_send_reschedule(int cpu) { } #define num_booting_cpus() 1 #define smp_prepare_boot_cpu() do {} while (0) static inline int smp_call_function_single(int cpuid, void (*func) (void *info), - void *info, int retry, int wait) + void *info, int retry, int wait) { - /* Disable interrupts here? */ - func(info); - return 0; + return -EBUSY; } #endif /* !SMP */ -- cgit v1.2.3 From e3dfd2964ea86ae65f511b10d62ea54d46db3708 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Wed, 16 May 2007 22:11:11 -0700 Subject: make freezeable workqueues singlethread It is a known fact that freezeable multithreaded workqueues doesn't like CPU_DEAD. We keep them only for the incoming CPU-hotplug rework. Sadly, we can't just kill create_freezeable_workqueue() right now, make them singlethread. Signed-off-by: Oleg Nesterov Cc: "Rafael J. Wysocki" Cc: Gautham R Shenoy Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/workqueue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index d555f31c074..7eae8665ff5 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -122,7 +122,7 @@ extern struct workqueue_struct *__create_workqueue(const char *name, int singlethread, int freezeable); #define create_workqueue(name) __create_workqueue((name), 0, 0) -#define create_freezeable_workqueue(name) __create_workqueue((name), 0, 1) +#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1) #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) extern void destroy_workqueue(struct workqueue_struct *wq); -- cgit v1.2.3 From bc88d5d4e18add7283770ead2734b601c50b3e2a Mon Sep 17 00:00:00 2001 From: wendy xiong Date: Wed, 16 May 2007 22:11:16 -0700 Subject: icom: add new sub-device-id to support new adapter This patch add new sub-device-id to support new adapter and changed the interrupt irq number for unsigned char to unsigned int. [akpm@osdl.org: fix whitespace in device table] Signed-off by: Wendy Xiong Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/pci_ids.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 3b1fbf49fa7..62b3e008e64 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -471,6 +471,7 @@ #define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_2 0x0219 #define PCI_DEVICE_ID_IBM_ICOM_V2_TWO_PORTS_RVX 0x021A #define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM 0x0251 +#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361 #define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 #define PCI_VENDOR_ID_COMPEX2 0x101a /* pci.ids says "AT&T GIS (NCR)" */ -- cgit v1.2.3 From 71ce92f3fa442069670a52fa6230a6064c4517b3 Mon Sep 17 00:00:00 2001 From: Dan Aloni Date: Wed, 16 May 2007 22:11:16 -0700 Subject: make sysctl/kernel/core_pattern and fs/exec.c agree on maximum core filename size Make sysctl/kernel/core_pattern and fs/exec.c agree on maximum core filename size and change it to 128, so that extensive patterns such as '/local/cores/%e-%h-%s-%t-%p.core' won't result in truncated filename generation. Signed-off-by: Dan Aloni Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/binfmts.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 2d956cd566a..e1a708337be 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -17,6 +17,8 @@ struct pt_regs; #ifdef __KERNEL__ +#define CORENAME_MAX_SIZE 128 + /* * This structure is used to hold the arguments that are used when loading binaries. */ -- cgit v1.2.3 From c97a9e10eaee328e6eea9f76acf7bacd7d48ef56 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Wed, 16 May 2007 22:11:21 -0700 Subject: mm: more rmap checking Re-introduce rmap verification patches that Hugh removed when he removed PG_map_lock. PG_map_lock actually isn't needed to synchronise access to anonymous pages, because PG_locked and PTL together already do. These checks were important in discovering and fixing a rare rmap corruption in SLES9. Signed-off-by: Nick Piggin Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/rmap.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/linux/rmap.h b/include/linux/rmap.h index bdd277223af..97347f22fc2 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -74,17 +74,14 @@ void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned lon void page_add_file_rmap(struct page *); void page_remove_rmap(struct page *, struct vm_area_struct *); -/** - * page_dup_rmap - duplicate pte mapping to a page - * @page: the page to add the mapping to - * - * For copy_page_range only: minimal extract from page_add_rmap, - * avoiding unnecessary tests (already checked) so it's quicker. - */ -static inline void page_dup_rmap(struct page *page) +#ifdef CONFIG_DEBUG_VM +void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address); +#else +static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address) { atomic_inc(&page->_mapcount); } +#endif /* * Called from mm/vmscan.c to handle paging out -- cgit v1.2.3