From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965248AbcJXP5b (ORCPT ); Mon, 24 Oct 2016 11:57:31 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:53429 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965167AbcJXP53 (ORCPT ); Mon, 24 Oct 2016 11:57:29 -0400 From: Arnd Bergmann To: Andrew Morton Cc: Arnd Bergmann , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vladimir Davydov , Jesper Dangaard Brouer , Johannes Weiner , Laura Abbott , Alexander Potapenko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] slub: avoid false-postive warning Date: Mon, 24 Oct 2016 17:56:13 +0200 Message-Id: <20161024155704.3114445-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:EX3BsidozcZxgqo+95DLEQYuZFU6Wbduq2dKYm3NaIu0KKRMkYV 9ATVaVhVWoYFGiK4DpVGd7JmXwL9ygrwT+aKvWisFBD73gqSD24vw5BOXb/pQRoFrR95cYq HwjETVpWNVWtImJAze7YzDsSwVQUrnc+gncjh/Y+1Po384FFBE2O/tJAe+ptqx0zFPB8bHo 10A/VUsTR6MkxdrI5PyuA== X-UI-Out-Filterresults: notjunk:1;V01:K0:oso/J7hC2/I=:q3RkFoPCkO3q02e+WVyXkb /1siurkhjefTctdk7Q5nu1AHRZN5aZW4NIDDEhBf1mdma+YLa9a1lhkCSX6F+R1K/NAJc1yXG s7E6FRefIVeMzVnkLmmjd3Cv19b+7ogtYjjxPg58JvfjdUfZkk1/pZ45bq2Y45gotIZ1+onAO BN923DB/dvGrCZftDnAKXa0p/zBQyhQHBY297TxaeKUNekBld8qf60lqhiIq2/fkj3rM2j0cU 0cO6qqCgHdduYixW498KGmoNY5Lnu0b2sy/YVOpsoyGyEDQPO5JmLZfFoOKQcxqPcNo01EJOS KKxBL2VW8o4/qajYkOmSKuVdRWbI0BIDzZ9A5dXw5ekuLw/7dPxUnqT7npeAiuwxZtI/fs6ML v6U6kGbeKOEHkw4YOtbRoYDwyL1oBs4PyZHhqJLpzmlU6SGEZ0XeNW+BF2q/ASMxrr0UEHszj fyov1Y0YOXV8A4IJYtuVH9BGZ0iBXg2yUocgJjTv8GKqFlJSFQzRvRJAsFzAcPqfql5sTQuEv kOZRAaSyuZhQDXU78fewFhK/lWzwevss44EAiZw5RPkxFA907TiuwlLltkr4txHAadSaIXC0L 9NvFH3BKCscaDc16MUKUrS4Gcj89fnFKvmQf1ZkKfm6HhSCNDRzXNh88kx1nGPxEmO0nVJ8tJ 0yQlEBS/+SUt/LNWYR6tFHCJ0yJhP7K3kgmv0fmc6PQzn8ekPATYFo6jsHcw5cGfQ4gw+qR+r RVH8OCUI1IGllGcz Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The slub allocator gives us some incorrect warnings when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, as the unlikely() macro prevents it from seeing that the return code matches what it was before: mm/slub.c: In function ‘kmem_cache_free_bulk’: mm/slub.c:262:23: error: ‘df.s’ may be used uninitialized in this function [-Werror=maybe-uninitialized] mm/slub.c:2943:3: error: ‘df.cnt’ may be used uninitialized in this function [-Werror=maybe-uninitialized] mm/slub.c:2933:4470: error: ‘df.freelist’ may be used uninitialized in this function [-Werror=maybe-uninitialized] mm/slub.c:2943:3: error: ‘df.tail’ may be used uninitialized in this function [-Werror=maybe-uninitialized] I have not been able to come up with a perfect way for dealing with this, the three options I see are: - add a bogus initialization, which would increase the runtime overhead - replace unlikely() with unlikely_notrace() - remove the unlikely() annotation completely I checked the object code for a typical x86 configuration and the last two cases produce the same result, so I went for the last one, which is the simplest. Signed-off-by: Arnd Bergmann --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 2b3e740609e9..68b84f93d38d 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3076,7 +3076,7 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p) struct detached_freelist df; size = build_detached_freelist(s, size, p, &df); - if (unlikely(!df.page)) + if (!df.page) continue; slab_free(df.s, df.page, df.freelist, df.tail, df.cnt,_RET_IP_); -- 2.9.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 6C4246B0253 for ; Mon, 24 Oct 2016 11:57:16 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id f193so35049908wmg.1 for ; Mon, 24 Oct 2016 08:57:16 -0700 (PDT) Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.13]) by mx.google.com with ESMTPS id s2si16796562wjx.245.2016.10.24.08.57.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 08:57:15 -0700 (PDT) From: Arnd Bergmann Subject: [PATCH] slub: avoid false-postive warning Date: Mon, 24 Oct 2016 17:56:13 +0200 Message-Id: <20161024155704.3114445-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Arnd Bergmann , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vladimir Davydov , Jesper Dangaard Brouer , Johannes Weiner , Laura Abbott , Alexander Potapenko , linux-mm@kvack.org, linux-kernel@vger.kernel.org The slub allocator gives us some incorrect warnings when CONFIG_PROFILE_ANNOTATED_BRANCHES is set, as the unlikely() macro prevents it from seeing that the return code matches what it was before: mm/slub.c: In function a??kmem_cache_free_bulka??: mm/slub.c:262:23: error: a??df.sa?? may be used uninitialized in this function [-Werror=maybe-uninitialized] mm/slub.c:2943:3: error: a??df.cnta?? may be used uninitialized in this function [-Werror=maybe-uninitialized] mm/slub.c:2933:4470: error: a??df.freelista?? may be used uninitialized in this function [-Werror=maybe-uninitialized] mm/slub.c:2943:3: error: a??df.taila?? may be used uninitialized in this function [-Werror=maybe-uninitialized] I have not been able to come up with a perfect way for dealing with this, the three options I see are: - add a bogus initialization, which would increase the runtime overhead - replace unlikely() with unlikely_notrace() - remove the unlikely() annotation completely I checked the object code for a typical x86 configuration and the last two cases produce the same result, so I went for the last one, which is the simplest. Signed-off-by: Arnd Bergmann --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 2b3e740609e9..68b84f93d38d 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3076,7 +3076,7 @@ void kmem_cache_free_bulk(struct kmem_cache *s, size_t size, void **p) struct detached_freelist df; size = build_detached_freelist(s, size, p, &df); - if (unlikely(!df.page)) + if (!df.page) continue; slab_free(df.s, df.page, df.freelist, df.tail, df.cnt,_RET_IP_); -- 2.9.0 -- 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: email@kvack.org