All of lore.kernel.org
 help / color / mirror / Atom feed
* next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-04 16:22 ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-04 16:22 UTC (permalink / raw)
  To: linux-next, linux-kernel, Christoph Lameter, Pekka Enberg,
	Matt Mackall, linux-mm

Hi,

I've hit boot problems in next-20130204 on Meta:

META213-Thread0 DSP [LogF] kobject (4fc03980): tried to init an initialized object, something is seriously wrong.
META213-Thread0 DSP [LogF] 
META213-Thread0 DSP [LogF] Call trace: 
META213-Thread0 DSP [LogF] [<4000888c>] _show_stack+0x68/0x7c
META213-Thread0 DSP [LogF] [<400088b4>] _dump_stack+0x14/0x28
META213-Thread0 DSP [LogF] [<40103794>] _kobject_init+0x58/0x9c
META213-Thread0 DSP [LogF] [<40103810>] _kobject_create+0x38/0x64
META213-Thread0 DSP [LogF] [<40103eac>] _kobject_create_and_add+0x14/0x8c
META213-Thread0 DSP [LogF] [<40190ac4>] _mnt_init+0xd8/0x220
META213-Thread0 DSP [LogF] [<40190508>] _vfs_caches_init+0xb0/0x160
META213-Thread0 DSP [LogF] [<401851f4>] _start_kernel+0x274/0x340
META213-Thread0 DSP [LogF] [<40188424>] _metag_start_kernel+0x58/0x6c
META213-Thread0 DSP [LogF] [<40000044>] __start+0x44/0x48
META213-Thread0 DSP [LogF] 
META213-Thread0 DSP [LogF] devtmpfs: initialized
META213-Thread0 DSP [LogF] L2 Cache: Not present
META213-Thread0 DSP [LogF] BUG: failure at fs/sysfs/dir.c:736/sysfs_read_ns_type()!
META213-Thread0 DSP [LogF] Kernel panic - not syncing: BUG!
META213-Thread0 DSP [Thread Exit] Thread has exited - return code = 4294967295

I've bisected it to the following commit:

commit 95a05b428cc675694321c8f762591984f3fd2b1e
Author: Christoph Lameter <cl@linux.com>
Date:   Thu Jan 10 19:14:19 2013 +0000

    slab: Common constants for kmalloc boundaries
    
    Standardize the constants that describe the smallest and largest
    object kept in the kmalloc arrays for SLAB and SLUB.
    
    Differentiate between the maximum size for which a slab cache is used
    (KMALLOC_MAX_CACHE_SIZE) and the maximum allocatable size
    (KMALLOC_MAX_SIZE, KMALLOC_MAX_ORDER).
    
    Signed-off-by: Christoph Lameter <cl@linux.com>
    Signed-off-by: Pekka Enberg <penberg@kernel.org>


Any ideas what could be going on here?

This commit merged with the metag for-next branch fails, but
the previous commit merged with the metag for-next branch
doesn't fail.

make savedefconfig output:

CONFIG_EXPERIMENTAL=y
# CONFIG_LOCALVERSION_AUTO is not set
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_LOG_BUF_SHIFT=13
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="arch/metag/boot/ramdisk.cpio"
CONFIG_INITRAMFS_COMPRESSION_GZIP=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_ELF_CORE is not set
CONFIG_SLAB=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_MSDOS_PARTITION is not set
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_METAG_L2C=y
CONFIG_FLATMEM_MANUAL=y
CONFIG_METAG_HALT_ON_PANIC=y
CONFIG_METAG_ATOMICITY_IRQSOFF=y
CONFIG_METAG_DA=y
CONFIG_HZ_100=y
CONFIG_DEVTMPFS=y
# CONFIG_STANDALONE is not set
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
# CONFIG_FW_LOADER is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=1
CONFIG_BLK_DEV_RAM_SIZE=16384
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_DA_TTY=y
CONFIG_DA_CONSOLE=y
# CONFIG_DEVKMEM is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_HWMON is not set
# CONFIG_USB_SUPPORT is not set
# CONFIG_DNOTIFY is not set
CONFIG_TMPFS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_SCHED_DEBUG is not set
CONFIG_DEBUG_INFO=y
CONFIG_FRAME_POINTER=y

Thanks
James


^ permalink raw reply	[flat|nested] 28+ messages in thread

* next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-04 16:22 ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-04 16:22 UTC (permalink / raw)
  To: linux-next, linux-kernel, Christoph Lameter, Pekka Enberg,
	Matt Mackall, linux-mm

Hi,

I've hit boot problems in next-20130204 on Meta:

META213-Thread0 DSP [LogF] kobject (4fc03980): tried to init an initialized object, something is seriously wrong.
META213-Thread0 DSP [LogF] 
META213-Thread0 DSP [LogF] Call trace: 
META213-Thread0 DSP [LogF] [<4000888c>] _show_stack+0x68/0x7c
META213-Thread0 DSP [LogF] [<400088b4>] _dump_stack+0x14/0x28
META213-Thread0 DSP [LogF] [<40103794>] _kobject_init+0x58/0x9c
META213-Thread0 DSP [LogF] [<40103810>] _kobject_create+0x38/0x64
META213-Thread0 DSP [LogF] [<40103eac>] _kobject_create_and_add+0x14/0x8c
META213-Thread0 DSP [LogF] [<40190ac4>] _mnt_init+0xd8/0x220
META213-Thread0 DSP [LogF] [<40190508>] _vfs_caches_init+0xb0/0x160
META213-Thread0 DSP [LogF] [<401851f4>] _start_kernel+0x274/0x340
META213-Thread0 DSP [LogF] [<40188424>] _metag_start_kernel+0x58/0x6c
META213-Thread0 DSP [LogF] [<40000044>] __start+0x44/0x48
META213-Thread0 DSP [LogF] 
META213-Thread0 DSP [LogF] devtmpfs: initialized
META213-Thread0 DSP [LogF] L2 Cache: Not present
META213-Thread0 DSP [LogF] BUG: failure at fs/sysfs/dir.c:736/sysfs_read_ns_type()!
META213-Thread0 DSP [LogF] Kernel panic - not syncing: BUG!
META213-Thread0 DSP [Thread Exit] Thread has exited - return code = 4294967295

I've bisected it to the following commit:

commit 95a05b428cc675694321c8f762591984f3fd2b1e
Author: Christoph Lameter <cl@linux.com>
Date:   Thu Jan 10 19:14:19 2013 +0000

    slab: Common constants for kmalloc boundaries
    
    Standardize the constants that describe the smallest and largest
    object kept in the kmalloc arrays for SLAB and SLUB.
    
    Differentiate between the maximum size for which a slab cache is used
    (KMALLOC_MAX_CACHE_SIZE) and the maximum allocatable size
    (KMALLOC_MAX_SIZE, KMALLOC_MAX_ORDER).
    
    Signed-off-by: Christoph Lameter <cl@linux.com>
    Signed-off-by: Pekka Enberg <penberg@kernel.org>


Any ideas what could be going on here?

This commit merged with the metag for-next branch fails, but
the previous commit merged with the metag for-next branch
doesn't fail.

make savedefconfig output:

CONFIG_EXPERIMENTAL=y
# CONFIG_LOCALVERSION_AUTO is not set
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_LOG_BUF_SHIFT=13
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="arch/metag/boot/ramdisk.cpio"
CONFIG_INITRAMFS_COMPRESSION_GZIP=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_ELF_CORE is not set
CONFIG_SLAB=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_MSDOS_PARTITION is not set
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_METAG_L2C=y
CONFIG_FLATMEM_MANUAL=y
CONFIG_METAG_HALT_ON_PANIC=y
CONFIG_METAG_ATOMICITY_IRQSOFF=y
CONFIG_METAG_DA=y
CONFIG_HZ_100=y
CONFIG_DEVTMPFS=y
# CONFIG_STANDALONE is not set
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
# CONFIG_FW_LOADER is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=1
CONFIG_BLK_DEV_RAM_SIZE=16384
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_DA_TTY=y
CONFIG_DA_CONSOLE=y
# CONFIG_DEVKMEM is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_HWMON is not set
# CONFIG_USB_SUPPORT is not set
# CONFIG_DNOTIFY is not set
CONFIG_TMPFS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_SCHED_DEBUG is not set
CONFIG_DEBUG_INFO=y
CONFIG_FRAME_POINTER=y

Thanks
James

^ permalink raw reply	[flat|nested] 28+ messages in thread

* next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-04 16:22 ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-04 16:22 UTC (permalink / raw)
  To: linux-next, linux-kernel, Christoph Lameter, Pekka Enberg,
	Matt Mackall, linux-mm

Hi,

I've hit boot problems in next-20130204 on Meta:

META213-Thread0 DSP [LogF] kobject (4fc03980): tried to init an initialized object, something is seriously wrong.
META213-Thread0 DSP [LogF] 
META213-Thread0 DSP [LogF] Call trace: 
META213-Thread0 DSP [LogF] [<4000888c>] _show_stack+0x68/0x7c
META213-Thread0 DSP [LogF] [<400088b4>] _dump_stack+0x14/0x28
META213-Thread0 DSP [LogF] [<40103794>] _kobject_init+0x58/0x9c
META213-Thread0 DSP [LogF] [<40103810>] _kobject_create+0x38/0x64
META213-Thread0 DSP [LogF] [<40103eac>] _kobject_create_and_add+0x14/0x8c
META213-Thread0 DSP [LogF] [<40190ac4>] _mnt_init+0xd8/0x220
META213-Thread0 DSP [LogF] [<40190508>] _vfs_caches_init+0xb0/0x160
META213-Thread0 DSP [LogF] [<401851f4>] _start_kernel+0x274/0x340
META213-Thread0 DSP [LogF] [<40188424>] _metag_start_kernel+0x58/0x6c
META213-Thread0 DSP [LogF] [<40000044>] __start+0x44/0x48
META213-Thread0 DSP [LogF] 
META213-Thread0 DSP [LogF] devtmpfs: initialized
META213-Thread0 DSP [LogF] L2 Cache: Not present
META213-Thread0 DSP [LogF] BUG: failure at fs/sysfs/dir.c:736/sysfs_read_ns_type()!
META213-Thread0 DSP [LogF] Kernel panic - not syncing: BUG!
META213-Thread0 DSP [Thread Exit] Thread has exited - return code = 4294967295

I've bisected it to the following commit:

commit 95a05b428cc675694321c8f762591984f3fd2b1e
Author: Christoph Lameter <cl@linux.com>
Date:   Thu Jan 10 19:14:19 2013 +0000

    slab: Common constants for kmalloc boundaries
    
    Standardize the constants that describe the smallest and largest
    object kept in the kmalloc arrays for SLAB and SLUB.
    
    Differentiate between the maximum size for which a slab cache is used
    (KMALLOC_MAX_CACHE_SIZE) and the maximum allocatable size
    (KMALLOC_MAX_SIZE, KMALLOC_MAX_ORDER).
    
    Signed-off-by: Christoph Lameter <cl@linux.com>
    Signed-off-by: Pekka Enberg <penberg@kernel.org>


Any ideas what could be going on here?

This commit merged with the metag for-next branch fails, but
the previous commit merged with the metag for-next branch
doesn't fail.

make savedefconfig output:

CONFIG_EXPERIMENTAL=y
# CONFIG_LOCALVERSION_AUTO is not set
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
CONFIG_LOG_BUF_SHIFT=13
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="arch/metag/boot/ramdisk.cpio"
CONFIG_INITRAMFS_COMPRESSION_GZIP=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_ELF_CORE is not set
CONFIG_SLAB=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_MSDOS_PARTITION is not set
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_METAG_L2C=y
CONFIG_FLATMEM_MANUAL=y
CONFIG_METAG_HALT_ON_PANIC=y
CONFIG_METAG_ATOMICITY_IRQSOFF=y
CONFIG_METAG_DA=y
CONFIG_HZ_100=y
CONFIG_DEVTMPFS=y
# CONFIG_STANDALONE is not set
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
# CONFIG_FW_LOADER is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=1
CONFIG_BLK_DEV_RAM_SIZE=16384
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_DA_TTY=y
CONFIG_DA_CONSOLE=y
# CONFIG_DEVKMEM is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_HWMON is not set
# CONFIG_USB_SUPPORT is not set
# CONFIG_DNOTIFY is not set
CONFIG_TMPFS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_SCHED_DEBUG is not set
CONFIG_DEBUG_INFO=y
CONFIG_FRAME_POINTER=y

Thanks
James

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-04 16:22 ` James Hogan
@ 2013-02-04 19:22   ` Christoph Lameter
  -1 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-04 19:22 UTC (permalink / raw)
  To: James Hogan
  Cc: linux-next, linux-kernel, Pekka Enberg, Matt Mackall, linux-mm

On Mon, 4 Feb 2013, James Hogan wrote:

> I've hit boot problems in next-20130204 on Meta:

Meta is an arch that is not in the tree yet? How would I build for meta?

What are the values of

MAX_ORDER
PAGE_SHIFT
ARCH_DMA_MINALIGN
CONFIG_ZONE_DMA

?


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-04 19:22   ` Christoph Lameter
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-04 19:22 UTC (permalink / raw)
  To: James Hogan
  Cc: linux-next, linux-kernel, Pekka Enberg, Matt Mackall, linux-mm

On Mon, 4 Feb 2013, James Hogan wrote:

> I've hit boot problems in next-20130204 on Meta:

Meta is an arch that is not in the tree yet? How would I build for meta?

What are the values of

MAX_ORDER
PAGE_SHIFT
ARCH_DMA_MINALIGN
CONFIG_ZONE_DMA

?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-04 16:22 ` James Hogan
@ 2013-02-04 19:39   ` Stephen Warren
  -1 siblings, 0 replies; 28+ messages in thread
From: Stephen Warren @ 2013-02-04 19:39 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 02/04/2013 09:22 AM, James Hogan wrote:
> Hi,
> 
> I've hit boot problems in next-20130204 on Meta:
> 
> META213-Thread0 DSP [LogF] kobject (4fc03980): tried to init an initialized object, something is seriously wrong.
> META213-Thread0 DSP [LogF] 
> META213-Thread0 DSP [LogF] Call trace: 
> META213-Thread0 DSP [LogF] [<4000888c>] _show_stack+0x68/0x7c
> META213-Thread0 DSP [LogF] [<400088b4>] _dump_stack+0x14/0x28
> META213-Thread0 DSP [LogF] [<40103794>] _kobject_init+0x58/0x9c
> META213-Thread0 DSP [LogF] [<40103810>] _kobject_create+0x38/0x64
> META213-Thread0 DSP [LogF] [<40103eac>] _kobject_create_and_add+0x14/0x8c
> META213-Thread0 DSP [LogF] [<40190ac4>] _mnt_init+0xd8/0x220
> META213-Thread0 DSP [LogF] [<40190508>] _vfs_caches_init+0xb0/0x160
...
> I've bisected it to the following commit:
> 
> commit 95a05b428cc675694321c8f762591984f3fd2b1e
> Author: Christoph Lameter <cl@linux.com>
> Date:   Thu Jan 10 19:14:19 2013 +0000
> 
>     slab: Common constants for kmalloc boundaries
>     
>     Standardize the constants that describe the smallest and largest
>     object kept in the kmalloc arrays for SLAB and SLUB.
>     
>     Differentiate between the maximum size for which a slab cache is used
>     (KMALLOC_MAX_CACHE_SIZE) and the maximum allocatable size
>     (KMALLOC_MAX_SIZE, KMALLOC_MAX_ORDER).
>     
>     Signed-off-by: Christoph Lameter <cl@linux.com>
>     Signed-off-by: Pekka Enberg <penberg@kernel.org>

I see the same problem on ARM. I believe it's because of the changes to
the calculation of MALLOC_SHIFT_LOW.

The old code was:

#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
#else
#ifdef CONFIG_SLAB
#define KMALLOC_MIN_SIZE 32
#else
#define KMALLOC_MIN_SIZE 8
#endif
#endif

#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)

Here, KMALLOC_SHIFT_LOW and KMALLOC_MIN_SIZE are always consistent/related.

The new code is:

#define KMALLOC_SHIFT_LOW	5
...
#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
#else
#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
#endif

Here, if defined(ARCH_DMA_MINALIGN), then KMALLOC_MIN_SIZE isn't
relative-to/derived-from KMALLOC_SHIFT_LOW, so the two may become
inconsistent.

On my ARM system at least, CONFIG_ARM_L1_CACHE_SHIFT_6 is set since I
have an ARMv7 CPU (see arch/arm/mm/Kconfig), which causes
CONFIG_ARM_L1_CACHE_SHIFT=6, then:

> arch/arm/include/asm/cache.h:7:#define L1_CACHE_SHIFT		CONFIG_ARM_L1_CACHE_SHIFT
> arch/arm/include/asm/cache.h:8:#define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
> arch/arm/include/asm/cache.h:17:#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES

... hence that case triggers.

I also see that in most parts of the patch, SLUB_PAGE_SHIFT was replaced
with (KMALLOC_SHIFT_HIGH + 1), or equivalently tests were changed from <
to <=:

> -		size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) {
> +		size <= KMALLOC_MAX_CACHE_SIZE && !(flags & SLUB_DMA)) {

However, the following doesn't seem to have that adjustment:

> diff --git a/mm/slub.c b/mm/slub.c
> index ba2ca53..d0f72ee 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2775,7 +2775,7 @@ init_kmem_cache_node(struct kmem_cache_node *n)
>  static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
>  {
>  	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
> -			SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu));
> +			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));

Should that also be (KMALLOC_SHIFT_HIGH + 1)?

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-04 19:39   ` Stephen Warren
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Warren @ 2013-02-04 19:39 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 02/04/2013 09:22 AM, James Hogan wrote:
> Hi,
> 
> I've hit boot problems in next-20130204 on Meta:
> 
> META213-Thread0 DSP [LogF] kobject (4fc03980): tried to init an initialized object, something is seriously wrong.
> META213-Thread0 DSP [LogF] 
> META213-Thread0 DSP [LogF] Call trace: 
> META213-Thread0 DSP [LogF] [<4000888c>] _show_stack+0x68/0x7c
> META213-Thread0 DSP [LogF] [<400088b4>] _dump_stack+0x14/0x28
> META213-Thread0 DSP [LogF] [<40103794>] _kobject_init+0x58/0x9c
> META213-Thread0 DSP [LogF] [<40103810>] _kobject_create+0x38/0x64
> META213-Thread0 DSP [LogF] [<40103eac>] _kobject_create_and_add+0x14/0x8c
> META213-Thread0 DSP [LogF] [<40190ac4>] _mnt_init+0xd8/0x220
> META213-Thread0 DSP [LogF] [<40190508>] _vfs_caches_init+0xb0/0x160
...
> I've bisected it to the following commit:
> 
> commit 95a05b428cc675694321c8f762591984f3fd2b1e
> Author: Christoph Lameter <cl@linux.com>
> Date:   Thu Jan 10 19:14:19 2013 +0000
> 
>     slab: Common constants for kmalloc boundaries
>     
>     Standardize the constants that describe the smallest and largest
>     object kept in the kmalloc arrays for SLAB and SLUB.
>     
>     Differentiate between the maximum size for which a slab cache is used
>     (KMALLOC_MAX_CACHE_SIZE) and the maximum allocatable size
>     (KMALLOC_MAX_SIZE, KMALLOC_MAX_ORDER).
>     
>     Signed-off-by: Christoph Lameter <cl@linux.com>
>     Signed-off-by: Pekka Enberg <penberg@kernel.org>

I see the same problem on ARM. I believe it's because of the changes to
the calculation of MALLOC_SHIFT_LOW.

The old code was:

#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
#else
#ifdef CONFIG_SLAB
#define KMALLOC_MIN_SIZE 32
#else
#define KMALLOC_MIN_SIZE 8
#endif
#endif

#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)

Here, KMALLOC_SHIFT_LOW and KMALLOC_MIN_SIZE are always consistent/related.

The new code is:

#define KMALLOC_SHIFT_LOW	5
...
#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
#else
#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
#endif

Here, if defined(ARCH_DMA_MINALIGN), then KMALLOC_MIN_SIZE isn't
relative-to/derived-from KMALLOC_SHIFT_LOW, so the two may become
inconsistent.

On my ARM system at least, CONFIG_ARM_L1_CACHE_SHIFT_6 is set since I
have an ARMv7 CPU (see arch/arm/mm/Kconfig), which causes
CONFIG_ARM_L1_CACHE_SHIFT=6, then:

> arch/arm/include/asm/cache.h:7:#define L1_CACHE_SHIFT		CONFIG_ARM_L1_CACHE_SHIFT
> arch/arm/include/asm/cache.h:8:#define L1_CACHE_BYTES		(1 << L1_CACHE_SHIFT)
> arch/arm/include/asm/cache.h:17:#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES

... hence that case triggers.

I also see that in most parts of the patch, SLUB_PAGE_SHIFT was replaced
with (KMALLOC_SHIFT_HIGH + 1), or equivalently tests were changed from <
to <=:

> -		size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) {
> +		size <= KMALLOC_MAX_CACHE_SIZE && !(flags & SLUB_DMA)) {

However, the following doesn't seem to have that adjustment:

> diff --git a/mm/slub.c b/mm/slub.c
> index ba2ca53..d0f72ee 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2775,7 +2775,7 @@ init_kmem_cache_node(struct kmem_cache_node *n)
>  static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
>  {
>  	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
> -			SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu));
> +			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));

Should that also be (KMALLOC_SHIFT_HIGH + 1)?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-04 19:39   ` Stephen Warren
@ 2013-02-05  2:29     ` Christoph Lameter
  -1 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05  2:29 UTC (permalink / raw)
  To: Stephen Warren
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On Mon, 4 Feb 2013, Stephen Warren wrote:

> Here, if defined(ARCH_DMA_MINALIGN), then KMALLOC_MIN_SIZE isn't
> relative-to/derived-from KMALLOC_SHIFT_LOW, so the two may become
> inconsistent.

Right. And kmalloc_index() will therefore return KMALLOC_SHIFT_LOW which
will dereference a NULL pointer since only the later cache pointers are
populated. KMALLOC_SHIFT_LOW needs to be set correctly.

> > diff --git a/mm/slub.c b/mm/slub.c
> > index ba2ca53..d0f72ee 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -2775,7 +2775,7 @@ init_kmem_cache_node(struct kmem_cache_node *n)
> >  static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
> >  {
> >  	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
> > -			SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu));
> > +			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));
>
> Should that also be (KMALLOC_SHIFT_HIGH + 1)?

That is already a pretty fuzzy test. The nr of kmem_cache_cpu allocated is
lower than KMALLOC_SHIFT_HIGH since several index positions will not be
occupied.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05  2:29     ` Christoph Lameter
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05  2:29 UTC (permalink / raw)
  To: Stephen Warren
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On Mon, 4 Feb 2013, Stephen Warren wrote:

> Here, if defined(ARCH_DMA_MINALIGN), then KMALLOC_MIN_SIZE isn't
> relative-to/derived-from KMALLOC_SHIFT_LOW, so the two may become
> inconsistent.

Right. And kmalloc_index() will therefore return KMALLOC_SHIFT_LOW which
will dereference a NULL pointer since only the later cache pointers are
populated. KMALLOC_SHIFT_LOW needs to be set correctly.

> > diff --git a/mm/slub.c b/mm/slub.c
> > index ba2ca53..d0f72ee 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -2775,7 +2775,7 @@ init_kmem_cache_node(struct kmem_cache_node *n)
> >  static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
> >  {
> >  	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
> > -			SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu));
> > +			KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu));
>
> Should that also be (KMALLOC_SHIFT_HIGH + 1)?

That is already a pretty fuzzy test. The nr of kmem_cache_cpu allocated is
lower than KMALLOC_SHIFT_HIGH since several index positions will not be
occupied.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-04 19:22   ` Christoph Lameter
@ 2013-02-05 10:08     ` James Hogan
  -1 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-05 10:08 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-next, linux-kernel, Pekka Enberg, Matt Mackall, linux-mm,
	Stephen Warren

On 04/02/13 19:22, Christoph Lameter wrote:
> On Mon, 4 Feb 2013, James Hogan wrote:
> 
>> I've hit boot problems in next-20130204 on Meta:
> 
> Meta is an arch that is not in the tree yet? How would I build for meta?

Yes (well, it's in -next now, so merging the for-next branch of
git://github.com/jahogan/metag-linux.git would add Meta support, which
at the point of your commit produces no conflicts).

It sounds like Stephen Warren has hit the same problem (in the
configuration I'm using ARCH_DMA_MINALIGN was also 64, but in another
configuration that worked, ARCH_DMA_MINALIGN was 8 (see
arch/metag/include/asm/cache.h).

For the record though, to cross compile, you'd need to build a
meta2_defconfig of the buildroot at
git://github.com/img-meta/metag-buildroot.git.

Cheers
James


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 10:08     ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-05 10:08 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-next, linux-kernel, Pekka Enberg, Matt Mackall, linux-mm,
	Stephen Warren

On 04/02/13 19:22, Christoph Lameter wrote:
> On Mon, 4 Feb 2013, James Hogan wrote:
> 
>> I've hit boot problems in next-20130204 on Meta:
> 
> Meta is an arch that is not in the tree yet? How would I build for meta?

Yes (well, it's in -next now, so merging the for-next branch of
git://github.com/jahogan/metag-linux.git would add Meta support, which
at the point of your commit produces no conflicts).

It sounds like Stephen Warren has hit the same problem (in the
configuration I'm using ARCH_DMA_MINALIGN was also 64, but in another
configuration that worked, ARCH_DMA_MINALIGN was 8 (see
arch/metag/include/asm/cache.h).

For the record though, to cross compile, you'd need to build a
meta2_defconfig of the buildroot at
git://github.com/img-meta/metag-buildroot.git.

Cheers
James

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-04 19:22   ` Christoph Lameter
  (?)
@ 2013-02-05 12:51     ` James Hogan
  -1 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-05 12:51 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-next, linux-kernel, Pekka Enberg, Matt Mackall, linux-mm

Hi Christoph,

On 04/02/13 19:22, Christoph Lameter wrote:
> What are the values of
> 
> MAX_ORDER

10

> PAGE_SHIFT

12

> ARCH_DMA_MINALIGN

64 (it works if changed to 8)

> CONFIG_ZONE_DMA

not defined

Cheers
James


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 12:51     ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-05 12:51 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-next, linux-kernel, Pekka Enberg, Matt Mackall, linux-mm

Hi Christoph,

On 04/02/13 19:22, Christoph Lameter wrote:
> What are the values of
> 
> MAX_ORDER

10

> PAGE_SHIFT

12

> ARCH_DMA_MINALIGN

64 (it works if changed to 8)

> CONFIG_ZONE_DMA

not defined

Cheers
James

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 12:51     ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-05 12:51 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-next, linux-kernel, Pekka Enberg, Matt Mackall, linux-mm

Hi Christoph,

On 04/02/13 19:22, Christoph Lameter wrote:
> What are the values of
> 
> MAX_ORDER

10

> PAGE_SHIFT

12

> ARCH_DMA_MINALIGN

64 (it works if changed to 8)

> CONFIG_ZONE_DMA

not defined

Cheers
James

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
       [not found]   ` <alpine.DEB.2.02.1302042019170.32396@gentwo.org>
@ 2013-02-05 16:36       ` Christoph Lameter
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05 16:36 UTC (permalink / raw)
  To: Stephen Warren
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
patch fixes it here:


Subject: slab: Handle ARCH_DMA_MINALIGN correctly

A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
requirements.

Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.

Signed-off-by: Christoph Lameter <cl@linux.com>

Index: linux/include/linux/slab.h
===================================================================
--- linux.orig/include/linux/slab.h	2013-02-05 10:30:53.917724146 -0600
+++ linux/include/linux/slab.h	2013-02-05 10:31:01.181836707 -0600
@@ -133,6 +133,19 @@ void kfree(const void *);
 void kzfree(const void *);
 size_t ksize(const void *);

+/*
+ * Some archs want to perform DMA into kmalloc caches and need a guaranteed
+ * alignment larger than the alignment of a 64-bit integer.
+ * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
+ */
+#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
+#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
+#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
+#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
+#else
+#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
+#endif
+
 #ifdef CONFIG_SLOB
 /*
  * Common fields provided in kmem_cache by all slab allocators
@@ -179,7 +192,9 @@ struct kmem_cache {
 #define KMALLOC_SHIFT_HIGH	((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
 				(MAX_ORDER + PAGE_SHIFT - 1) : 25)
 #define KMALLOC_SHIFT_MAX	KMALLOC_SHIFT_HIGH
+#ifndef KMALLOC_SHIFT_LOW
 #define KMALLOC_SHIFT_LOW	5
+#endif
 #else
 /*
  * SLUB allocates up to order 2 pages directly and otherwise
@@ -187,8 +202,10 @@ struct kmem_cache {
  */
 #define KMALLOC_SHIFT_HIGH	(PAGE_SHIFT + 1)
 #define KMALLOC_SHIFT_MAX	(MAX_ORDER + PAGE_SHIFT)
+#ifndef KMALLOC_SHIFT_LOW
 #define KMALLOC_SHIFT_LOW	3
 #endif
+#endif

 /* Maximum allocatable size */
 #define KMALLOC_MAX_SIZE	(1UL << KMALLOC_SHIFT_MAX)
@@ -200,9 +217,7 @@ struct kmem_cache {
 /*
  * Kmalloc subsystem.
  */
-#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
-#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
-#else
+#ifndef KMALLOC_MIN_SIZE
 #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
 #endif

@@ -285,17 +300,6 @@ static __always_inline int kmalloc_size(
 #endif /* !CONFIG_SLOB */

 /*
- * Some archs want to perform DMA into kmalloc caches and need a guaranteed
- * alignment larger than the alignment of a 64-bit integer.
- * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
- */
-#ifdef ARCH_DMA_MINALIGN
-#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
-#else
-#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
-#endif
-
-/*
  * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
  * Intended for arches that get misalignment faults even for 64 bit integer
  * aligned buffers.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 16:36       ` Christoph Lameter
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05 16:36 UTC (permalink / raw)
  To: Stephen Warren
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
patch fixes it here:


Subject: slab: Handle ARCH_DMA_MINALIGN correctly

A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
requirements.

Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.

Signed-off-by: Christoph Lameter <cl@linux.com>

Index: linux/include/linux/slab.h
===================================================================
--- linux.orig/include/linux/slab.h	2013-02-05 10:30:53.917724146 -0600
+++ linux/include/linux/slab.h	2013-02-05 10:31:01.181836707 -0600
@@ -133,6 +133,19 @@ void kfree(const void *);
 void kzfree(const void *);
 size_t ksize(const void *);

+/*
+ * Some archs want to perform DMA into kmalloc caches and need a guaranteed
+ * alignment larger than the alignment of a 64-bit integer.
+ * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
+ */
+#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
+#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
+#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
+#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
+#else
+#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
+#endif
+
 #ifdef CONFIG_SLOB
 /*
  * Common fields provided in kmem_cache by all slab allocators
@@ -179,7 +192,9 @@ struct kmem_cache {
 #define KMALLOC_SHIFT_HIGH	((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
 				(MAX_ORDER + PAGE_SHIFT - 1) : 25)
 #define KMALLOC_SHIFT_MAX	KMALLOC_SHIFT_HIGH
+#ifndef KMALLOC_SHIFT_LOW
 #define KMALLOC_SHIFT_LOW	5
+#endif
 #else
 /*
  * SLUB allocates up to order 2 pages directly and otherwise
@@ -187,8 +202,10 @@ struct kmem_cache {
  */
 #define KMALLOC_SHIFT_HIGH	(PAGE_SHIFT + 1)
 #define KMALLOC_SHIFT_MAX	(MAX_ORDER + PAGE_SHIFT)
+#ifndef KMALLOC_SHIFT_LOW
 #define KMALLOC_SHIFT_LOW	3
 #endif
+#endif

 /* Maximum allocatable size */
 #define KMALLOC_MAX_SIZE	(1UL << KMALLOC_SHIFT_MAX)
@@ -200,9 +217,7 @@ struct kmem_cache {
 /*
  * Kmalloc subsystem.
  */
-#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
-#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
-#else
+#ifndef KMALLOC_MIN_SIZE
 #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
 #endif

@@ -285,17 +300,6 @@ static __always_inline int kmalloc_size(
 #endif /* !CONFIG_SLOB */

 /*
- * Some archs want to perform DMA into kmalloc caches and need a guaranteed
- * alignment larger than the alignment of a 64-bit integer.
- * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
- */
-#ifdef ARCH_DMA_MINALIGN
-#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
-#else
-#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
-#endif
-
-/*
  * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
  * Intended for arches that get misalignment faults even for 64 bit integer
  * aligned buffers.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-05 16:36       ` Christoph Lameter
@ 2013-02-05 17:08         ` James Hogan
  -1 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-05 17:08 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Stephen Warren, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 05/02/13 16:36, Christoph Lameter wrote:
> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
> patch fixes it here:
> 
> 
> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
> 
> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
> requirements.
> 
> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
> 
> Signed-off-by: Christoph Lameter <cl@linux.com>

Thanks, your patch fixes it for me.

Cheers
James


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 17:08         ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-05 17:08 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Stephen Warren, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 05/02/13 16:36, Christoph Lameter wrote:
> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
> patch fixes it here:
> 
> 
> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
> 
> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
> requirements.
> 
> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
> 
> Signed-off-by: Christoph Lameter <cl@linux.com>

Thanks, your patch fixes it for me.

Cheers
James

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-05 16:36       ` Christoph Lameter
@ 2013-02-05 18:28         ` Stephen Warren
  -1 siblings, 0 replies; 28+ messages in thread
From: Stephen Warren @ 2013-02-05 18:28 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 02/05/2013 09:36 AM, Christoph Lameter wrote:
> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
> patch fixes it here:
> 
> 
> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
> 
> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
> requirements.
> 
> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.

Tested-by: Stephen Warren <swarren@nvidia.com>

> +/*
> + * Some archs want to perform DMA into kmalloc caches and need a guaranteed
> + * alignment larger than the alignment of a 64-bit integer.
> + * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
> + */
> +#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
> +#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
> +#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN

I might be tempted to drop that #define of KMALLOC_MIN_SIZE ...

> +#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
> +#else
> +#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
> +#endif

> +#ifndef KMALLOC_MIN_SIZE
>  #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
>  #endif

... and simply drop the ifdef around that #define instead.

That way, KMALLOC_MIN_SIZE is always defined in one place, and derived
from KMALLOC_SHIFT_LOW; the logic will just set KMALLOC_SHIFT_LOW based
on the various conditions. This seems a little safer to me; fewer
conditions and less code to update if anything changes.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 18:28         ` Stephen Warren
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Warren @ 2013-02-05 18:28 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 02/05/2013 09:36 AM, Christoph Lameter wrote:
> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
> patch fixes it here:
> 
> 
> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
> 
> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
> requirements.
> 
> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.

Tested-by: Stephen Warren <swarren@nvidia.com>

> +/*
> + * Some archs want to perform DMA into kmalloc caches and need a guaranteed
> + * alignment larger than the alignment of a 64-bit integer.
> + * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
> + */
> +#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
> +#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
> +#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN

I might be tempted to drop that #define of KMALLOC_MIN_SIZE ...

> +#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
> +#else
> +#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
> +#endif

> +#ifndef KMALLOC_MIN_SIZE
>  #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
>  #endif

... and simply drop the ifdef around that #define instead.

That way, KMALLOC_MIN_SIZE is always defined in one place, and derived
from KMALLOC_SHIFT_LOW; the logic will just set KMALLOC_SHIFT_LOW based
on the various conditions. This seems a little safer to me; fewer
conditions and less code to update if anything changes.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-05 17:08         ` James Hogan
@ 2013-02-05 18:34           ` Christoph Lameter
  -1 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05 18:34 UTC (permalink / raw)
  To: James Hogan
  Cc: Stephen Warren, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On Tue, 5 Feb 2013, James Hogan wrote:

> On 05/02/13 16:36, Christoph Lameter wrote:
> > OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
> > patch fixes it here:
> >
> >
> > Subject: slab: Handle ARCH_DMA_MINALIGN correctly
> >
> > A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
> > requirements.
> >
> > Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
> >
> > Signed-off-by: Christoph Lameter <cl@linux.com>
>
> Thanks, your patch fixes it for me.

Ok I guess that implies a Tested-by:


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 18:34           ` Christoph Lameter
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05 18:34 UTC (permalink / raw)
  To: James Hogan
  Cc: Stephen Warren, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On Tue, 5 Feb 2013, James Hogan wrote:

> On 05/02/13 16:36, Christoph Lameter wrote:
> > OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
> > patch fixes it here:
> >
> >
> > Subject: slab: Handle ARCH_DMA_MINALIGN correctly
> >
> > A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
> > requirements.
> >
> > Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
> >
> > Signed-off-by: Christoph Lameter <cl@linux.com>
>
> Thanks, your patch fixes it for me.

Ok I guess that implies a Tested-by:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-05 18:28         ` Stephen Warren
@ 2013-02-05 18:52           ` Christoph Lameter
  -1 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05 18:52 UTC (permalink / raw)
  To: Stephen Warren
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On Tue, 5 Feb 2013, Stephen Warren wrote:

> > +/*
> > + * Some archs want to perform DMA into kmalloc caches and need a guaranteed
> > + * alignment larger than the alignment of a 64-bit integer.
> > + * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
> > + */
> > +#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
> > +#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
> > +#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
>
> I might be tempted to drop that #define of KMALLOC_MIN_SIZE ...

Initially I thought so too.
>
> > +#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
> > +#else
> > +#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
> > +#endif
>
> > +#ifndef KMALLOC_MIN_SIZE
> >  #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
> >  #endif
>
> ... and simply drop the ifdef around that #define instead.

That is going to be one hell of a macro expansion.

> That way, KMALLOC_MIN_SIZE is always defined in one place, and derived
> from KMALLOC_SHIFT_LOW; the logic will just set KMALLOC_SHIFT_LOW based
> on the various conditions. This seems a little safer to me; fewer
> conditions and less code to update if anything changes.

Yeah but we do an ilog2 and then reverse this back to the original number.


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-05 18:52           ` Christoph Lameter
  0 siblings, 0 replies; 28+ messages in thread
From: Christoph Lameter @ 2013-02-05 18:52 UTC (permalink / raw)
  To: Stephen Warren
  Cc: James Hogan, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On Tue, 5 Feb 2013, Stephen Warren wrote:

> > +/*
> > + * Some archs want to perform DMA into kmalloc caches and need a guaranteed
> > + * alignment larger than the alignment of a 64-bit integer.
> > + * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
> > + */
> > +#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
> > +#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
> > +#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
>
> I might be tempted to drop that #define of KMALLOC_MIN_SIZE ...

Initially I thought so too.
>
> > +#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
> > +#else
> > +#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
> > +#endif
>
> > +#ifndef KMALLOC_MIN_SIZE
> >  #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
> >  #endif
>
> ... and simply drop the ifdef around that #define instead.

That is going to be one hell of a macro expansion.

> That way, KMALLOC_MIN_SIZE is always defined in one place, and derived
> from KMALLOC_SHIFT_LOW; the logic will just set KMALLOC_SHIFT_LOW based
> on the various conditions. This seems a little safer to me; fewer
> conditions and less code to update if anything changes.

Yeah but we do an ilog2 and then reverse this back to the original number.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-05 18:34           ` Christoph Lameter
@ 2013-02-06  9:44             ` James Hogan
  -1 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-06  9:44 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Stephen Warren, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 05/02/13 18:34, Christoph Lameter wrote:
> On Tue, 5 Feb 2013, James Hogan wrote:
> 
>> On 05/02/13 16:36, Christoph Lameter wrote:
>>> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
>>> patch fixes it here:
>>>
>>>
>>> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
>>>
>>> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
>>> requirements.
>>>
>>> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
>>>
>>> Signed-off-by: Christoph Lameter <cl@linux.com>
>>
>> Thanks, your patch fixes it for me.
> 
> Ok I guess that implies a Tested-by:
> 

Yep sorry, feel free to add my Tested-by: if you roll this as a separate
patch.

Cheers
James


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-06  9:44             ` James Hogan
  0 siblings, 0 replies; 28+ messages in thread
From: James Hogan @ 2013-02-06  9:44 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Stephen Warren, linux-next, linux-kernel, Pekka Enberg,
	Matt Mackall, linux-mm

On 05/02/13 18:34, Christoph Lameter wrote:
> On Tue, 5 Feb 2013, James Hogan wrote:
> 
>> On 05/02/13 16:36, Christoph Lameter wrote:
>>> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
>>> patch fixes it here:
>>>
>>>
>>> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
>>>
>>> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
>>> requirements.
>>>
>>> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
>>>
>>> Signed-off-by: Christoph Lameter <cl@linux.com>
>>
>> Thanks, your patch fixes it for me.
> 
> Ok I guess that implies a Tested-by:
> 

Yep sorry, feel free to add my Tested-by: if you roll this as a separate
patch.

Cheers
James

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
  2013-02-06  9:44             ` James Hogan
@ 2013-02-06 18:33               ` Pekka Enberg
  -1 siblings, 0 replies; 28+ messages in thread
From: Pekka Enberg @ 2013-02-06 18:33 UTC (permalink / raw)
  To: James Hogan
  Cc: Christoph Lameter, Stephen Warren, linux-next, linux-kernel,
	Matt Mackall, linux-mm

On Wed, Feb 6, 2013 at 11:44 AM, James Hogan <james.hogan@imgtec.com> wrote:
> On 05/02/13 18:34, Christoph Lameter wrote:
>> On Tue, 5 Feb 2013, James Hogan wrote:
>>
>>> On 05/02/13 16:36, Christoph Lameter wrote:
>>>> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
>>>> patch fixes it here:
>>>>
>>>>
>>>> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
>>>>
>>>> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
>>>> requirements.
>>>>
>>>> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
>>>>
>>>> Signed-off-by: Christoph Lameter <cl@linux.com>
>>>
>>> Thanks, your patch fixes it for me.
>>
>> Ok I guess that implies a Tested-by:
>>
>
> Yep sorry, feel free to add my Tested-by: if you roll this as a separate
> patch.

Applied, thanks guys!

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries"
@ 2013-02-06 18:33               ` Pekka Enberg
  0 siblings, 0 replies; 28+ messages in thread
From: Pekka Enberg @ 2013-02-06 18:33 UTC (permalink / raw)
  To: James Hogan
  Cc: Christoph Lameter, Stephen Warren, linux-next, linux-kernel,
	Matt Mackall, linux-mm

On Wed, Feb 6, 2013 at 11:44 AM, James Hogan <james.hogan@imgtec.com> wrote:
> On 05/02/13 18:34, Christoph Lameter wrote:
>> On Tue, 5 Feb 2013, James Hogan wrote:
>>
>>> On 05/02/13 16:36, Christoph Lameter wrote:
>>>> OK I was able to reproduce it by setting ARCH_DMA_MINALIGN in slab.h. This
>>>> patch fixes it here:
>>>>
>>>>
>>>> Subject: slab: Handle ARCH_DMA_MINALIGN correctly
>>>>
>>>> A fixed KMALLOC_SHIFT_LOW does not work for arches with higher alignment
>>>> requirements.
>>>>
>>>> Determine KMALLOC_SHIFT_LOW from ARCH_DMA_MINALIGN instead.
>>>>
>>>> Signed-off-by: Christoph Lameter <cl@linux.com>
>>>
>>> Thanks, your patch fixes it for me.
>>
>> Ok I guess that implies a Tested-by:
>>
>
> Yep sorry, feel free to add my Tested-by: if you roll this as a separate
> patch.

Applied, thanks guys!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2013-02-06 18:33 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-04 16:22 next-20130204 - bisected slab problem to "slab: Common constants for kmalloc boundaries" James Hogan
2013-02-04 16:22 ` James Hogan
2013-02-04 16:22 ` James Hogan
2013-02-04 19:22 ` Christoph Lameter
2013-02-04 19:22   ` Christoph Lameter
2013-02-05 10:08   ` James Hogan
2013-02-05 10:08     ` James Hogan
2013-02-05 12:51   ` James Hogan
2013-02-05 12:51     ` James Hogan
2013-02-05 12:51     ` James Hogan
2013-02-04 19:39 ` Stephen Warren
2013-02-04 19:39   ` Stephen Warren
2013-02-05  2:29   ` Christoph Lameter
2013-02-05  2:29     ` Christoph Lameter
     [not found]   ` <alpine.DEB.2.02.1302042019170.32396@gentwo.org>
2013-02-05 16:36     ` Christoph Lameter
2013-02-05 16:36       ` Christoph Lameter
2013-02-05 17:08       ` James Hogan
2013-02-05 17:08         ` James Hogan
2013-02-05 18:34         ` Christoph Lameter
2013-02-05 18:34           ` Christoph Lameter
2013-02-06  9:44           ` James Hogan
2013-02-06  9:44             ` James Hogan
2013-02-06 18:33             ` Pekka Enberg
2013-02-06 18:33               ` Pekka Enberg
2013-02-05 18:28       ` Stephen Warren
2013-02-05 18:28         ` Stephen Warren
2013-02-05 18:52         ` Christoph Lameter
2013-02-05 18:52           ` Christoph Lameter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.