Re: [patch] slab: always follow arch requested alignments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 23, 2006 at 06:03:09AM -0700, Christoph Lameter wrote:
> On Sun, 23 Jul 2006, Heiko Carstens wrote:
> > > See kmem_cache_create():
> > >       /* 2) arch mandated alignment: disables debug if necessary */
> > >         if (ralign < ARCH_SLAB_MINALIGN) {
> > >                 ralign = ARCH_SLAB_MINALIGN;
> > >                 if (ralign > BYTES_PER_WORD)
> > >                         flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
> > >         }
> > 
> > That is because if kmem_cache_create gets called with SLAB_HWCACHE_ALIGN set
> > in flags then ralign will be greater or equal to ARCH_SLAB_MINALIGN:
> > 
> >         /* 1) arch recommendation: can be overridden for debug */ 
> >         if (flags & SLAB_HWCACHE_ALIGN) { 
> > 	        [...]
> >                 ralign = cache_line_size(); 
> > 	        [...]
> 
> Ok. Then you do not have a problem because ralign is greater than
> ARCH_SLAB_MINALIGN.
>  
> > Therefore the test above will be passed and SLAB_RED_ZONE and SLAB_STORE_USER
> > will stay in flags.
> > cache_line_size() will return 256 on s390.
> 
> Looks as if you would have the correct alignment then. I still do not 
> understand where the problem is since you want to align on an 8 byte 
> boundary.

CONFIG_DEBUG_SLAB is on. In step 4) we have align = ralign.
Still ok.
Next thing:

	if (flags & SLAB_RED_ZONE) {
		/* redzoning only works with word aligned caches */
		align = BYTES_PER_WORD;

Result: align is less than ARCH_SLAB_MINALIGN -> busted.
Same is true if SLAB_STORE_USER is set.
Therefore I masked them both out in my patch.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux