From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546AbeBBPIR (ORCPT ); Fri, 2 Feb 2018 10:08:17 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:35189 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbeBBPIJ (ORCPT ); Fri, 2 Feb 2018 10:08:09 -0500 X-Google-Smtp-Source: AH8x225Zba9Y6+AWvl0V2FbPttYZQQqR04hcHQ4kK2zJISskOJB5iiezUt6svTnrCfIwweY3KtHj/w== Subject: Re: [PATCH] block: skd: fix incorrect linux/slab_def.h inclusion To: Arnd Bergmann , Bart Van Assche Cc: Nicolas Pitre , Andi Kleen , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180202150326.344024-1-arnd@arndb.de> From: Jens Axboe Message-ID: Date: Fri, 2 Feb 2018 08:08:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Thunderbird/58.0 MIME-Version: 1.0 In-Reply-To: <20180202150326.344024-1-arnd@arndb.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/2/18 8:03 AM, Arnd Bergmann wrote: > skd includes slab_def.h to get access to the slab cache object size. > However, including this header breaks when we use SLUB or SLOB instead of > the SLAB allocator, since the structure layout is completely different, > as shown by this warning when we build this driver in one of the invalid > configurations with link-time optimizations enabled: > > include/linux/slab.h:715:0: error: type of 'kmem_cache_size' does not match original declaration [-Werror=lto-type-mismatch] > unsigned int kmem_cache_size(struct kmem_cache *s); > > mm/slab_common.c:77:14: note: 'kmem_cache_size' was previously declared here > unsigned int kmem_cache_size(struct kmem_cache *s) > ^ > mm/slab_common.c:77:14: note: code may be misoptimized unless -fno-strict-aliasing is used > include/linux/slab.h:147:0: error: type of 'kmem_cache_destroy' does not match original declaration [-Werror=lto-type-mismatch] > void kmem_cache_destroy(struct kmem_cache *); > > mm/slab_common.c:858:6: note: 'kmem_cache_destroy' was previously declared here > void kmem_cache_destroy(struct kmem_cache *s) > ^ > mm/slab_common.c:858:6: note: code may be misoptimized unless -fno-strict-aliasing is used > include/linux/slab.h:140:0: error: type of 'kmem_cache_create' does not match original declaration [-Werror=lto-type-mismatch] > struct kmem_cache *kmem_cache_create(const char *name, size_t size, > > mm/slab_common.c:534:1: note: 'kmem_cache_create' was previously declared here > kmem_cache_create(const char *name, size_t size, size_t align,> ^ > > This removes the header inclusion and instead uses the kmem_cache_size() > interface to get the size in a reliable way. Thanks Arnd, applied. -- Jens Axboe