From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F84BC433FE for ; Fri, 4 Dec 2020 19:21:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E98B322CA0 for ; Fri, 4 Dec 2020 19:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730270AbgLDTVO (ORCPT ); Fri, 4 Dec 2020 14:21:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:55324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbgLDTVO (ORCPT ); Fri, 4 Dec 2020 14:21:14 -0500 Date: Fri, 4 Dec 2020 11:20:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607109632; bh=/XhZcYZ5JIA1PupN+XZqIdVnLydGrcJFS1sKBQ5lWX0=; h=From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=IXhPDkfkpAdhrnOXCRz73rGo8liOLaITMhwtX7K6IMUGF7NL+tyVPogXQwt7yOuD7 pFLLv20r4JMRSs2tuSZlwyphpez5o3YHfI1zZH1B1m0qZjlKoidX0BSypb6JfQ+ALZ d1/EgKFsXpN6Y55HbypNP/nO+lniIlTtc0mh+EWYMZKuncBK+AOTH3nbIm+26utiRZ oc6j1yqysz5cAXWBje0B2b+0pAUoVt5nT/vXcIpvGMZBFPt7PB613S5eOorKRBuNb3 VKVIKH6GVNWlsmuzG5EFuKdBzuAbooorr+nY1Jc7jXCeHo9DO1On4kPgpZ0JwPKDRn VSr0GMKeyLUlg== From: "Paul E. McKenney" To: Stephen Rothwell Cc: Linux Kernel Mailing List , Linux Next Mailing List Subject: Re: linux-next: build failure after merge of the rcu tree Message-ID: <20201204192032.GA1437@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20201204192526.0b38fb02@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201204192526.0b38fb02@canb.auug.org.au> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-next@vger.kernel.org On Fri, Dec 04, 2020 at 07:25:26PM +1100, Stephen Rothwell wrote: > Hi all, > > After merging the rcu tree, today's linux-next build (sparc defconfig) > failed like this: > > mm/slab_common.o: In function `kmem_last_alloc': > slab_common.c:(.text+0xc4): undefined reference to `kmem_cache_last_alloc' > > Caused by commit > > f7c3fb4fc476 ("mm: Add kmem_last_alloc() to return last allocation for memory block") > > in mm/slab.c, kmem_cache_last_alloc() is only defined when CONFIG_NUMA > is set - which is not for this build. > > I applied the following hack fix patch for today. > > From ac5dcf78be1e6da530302966369a3bd63007cf81 Mon Sep 17 00:00:00 2001 > From: Stephen Rothwell > Date: Fri, 4 Dec 2020 19:11:01 +1100 > Subject: [PATCH] fixup for "mm: Add kmem_last_alloc() to return last > allocation for memory block" > > Signed-off-by: Stephen Rothwell Apologies for the hassle and thank you for the very helpful "hack fix patch". The kbuild test robot also found this, but I hadn't quite gotten it through my head that the only slab definition of the kmem_cache_last_alloc() was under CONFIG_NUMA. Does the following patch fix things? (Sigh. It won't apply on the rcu/next that you used. Or even on this moment's dev branch. I will fold it in with attribution and update. But just to show you what my thought is.) Thanx, Paul ------------------------------------------------------------------------ diff --git a/mm/slab.c b/mm/slab.c index 87aa2c0..ae1a74c 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3602,27 +3602,6 @@ void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep, EXPORT_SYMBOL(kmem_cache_alloc_node_trace); #endif -void *kmem_cache_last_alloc(struct kmem_cache *cachep, void *object, void **stackp, int nstackp) -{ -#ifdef DEBUG - unsigned int objnr; - void *objp; - struct page *page; - - if (!(cachep->flags & SLAB_STORE_USER)) - return ERR_PTR(-KMEM_LA_NO_DEBUG); - objp = object - obj_offset(cachep); - page = virt_to_head_page(objp); - objnr = obj_to_index(cachep, page, objp); - objp = index_to_obj(cachep, page, objnr); - if (stackp && nstackp) - stackp[0] = NULL; - return *dbg_userword(cachep, objp); -#else - return NULL; -#endif -} - static __always_inline void * __do_kmalloc_node(size_t size, gfp_t flags, int node, unsigned long caller) { @@ -3654,6 +3633,27 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t flags, EXPORT_SYMBOL(__kmalloc_node_track_caller); #endif /* CONFIG_NUMA */ +void *kmem_cache_last_alloc(struct kmem_cache *cachep, void *object, void **stackp, int nstackp) +{ +#ifdef DEBUG + unsigned int objnr; + void *objp; + struct page *page; + + if (!(cachep->flags & SLAB_STORE_USER)) + return ERR_PTR(-KMEM_LA_NO_DEBUG); + objp = object - obj_offset(cachep); + page = virt_to_head_page(objp); + objnr = obj_to_index(cachep, page, objp); + objp = index_to_obj(cachep, page, objnr); + if (stackp && nstackp) + stackp[0] = NULL; + return *dbg_userword(cachep, objp); +#else + return NULL; +#endif +} + /** * __do_kmalloc - allocate memory * @size: how many bytes of memory are required.