forked from mirrors/linux
		
	slub: Remove objsize check in kmem_cache_flags()
There is no page->offset anymore and also no associated limit on the number of objects. The page->offset field was removed for 2.6.24. So the check in kmem_cache_flags() is now also obsolete (should have been dropped earlier, somehow a hunk vanished). Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-by: Christoph Lameter <clameter@sgi.com>
This commit is contained in:
		
							parent
							
								
									d9acf4b7b6
								
							
						
					
					
						commit
						e153362a50
					
				
					 1 changed files with 4 additions and 23 deletions
				
			
		
							
								
								
									
										21
									
								
								mm/slub.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								mm/slub.c
									
									
									
									
									
								
							| 
						 | 
					@ -996,31 +996,12 @@ static unsigned long kmem_cache_flags(unsigned long objsize,
 | 
				
			||||||
	unsigned long flags, const char *name,
 | 
						unsigned long flags, const char *name,
 | 
				
			||||||
	void (*ctor)(struct kmem_cache *, void *))
 | 
						void (*ctor)(struct kmem_cache *, void *))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * The page->offset field is only 16 bit wide. This is an offset
 | 
					 | 
				
			||||||
	 * in units of words from the beginning of an object. If the slab
 | 
					 | 
				
			||||||
	 * size is bigger then we cannot move the free pointer behind the
 | 
					 | 
				
			||||||
	 * object anymore.
 | 
					 | 
				
			||||||
	 *
 | 
					 | 
				
			||||||
	 * On 32 bit platforms the limit is 256k. On 64bit platforms
 | 
					 | 
				
			||||||
	 * the limit is 512k.
 | 
					 | 
				
			||||||
	 *
 | 
					 | 
				
			||||||
	 * Debugging or ctor may create a need to move the free
 | 
					 | 
				
			||||||
	 * pointer. Fail if this happens.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if (objsize >= 65535 * sizeof(void *)) {
 | 
					 | 
				
			||||||
		BUG_ON(flags & (SLAB_RED_ZONE | SLAB_POISON |
 | 
					 | 
				
			||||||
				SLAB_STORE_USER | SLAB_DESTROY_BY_RCU));
 | 
					 | 
				
			||||||
		BUG_ON(ctor);
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Enable debugging if selected on the kernel commandline.
 | 
						 * Enable debugging if selected on the kernel commandline.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (slub_debug && (!slub_debug_slabs ||
 | 
						if (slub_debug && (!slub_debug_slabs ||
 | 
				
			||||||
		    strncmp(slub_debug_slabs, name,
 | 
						    strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs)) == 0))
 | 
				
			||||||
			strlen(slub_debug_slabs)) == 0))
 | 
					 | 
				
			||||||
			flags |= slub_debug;
 | 
								flags |= slub_debug;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return flags;
 | 
						return flags;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue