Message ID | 20231216032651.3553101-5-kent.overstreet@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-1990-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp15426dyi; Fri, 15 Dec 2023 19:28:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfCzLzX0g0+uiJkMEhJe5W/d/li8EFHxHdz06O/9ibZJWeNwfUi4werJ2cs6mOT/Sq1EEq X-Received: by 2002:a05:620a:2290:b0:77f:3126:c010 with SMTP id o16-20020a05620a229000b0077f3126c010mr12960315qkh.129.1702697312152; Fri, 15 Dec 2023 19:28:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702697312; cv=none; d=google.com; s=arc-20160816; b=YmYFf7hbmARUnqegBFKfl9PQz2v0gHKnDxs0n2beFh8bqED2JL//fTGKSi6dGd2Rlt 2d1epZPDsd5fO8YNYcDBrvyyGodhx8JIVdogVd0gw/tK2Y39dhi/ZcsuKeTHe5T/+9Fw BT6LGHiC2UgJRpEO5t11Y/h6219xD4ugfFnt3tCDnyT7UwGt+3mZK3mu3ZWfQcuTHBVB Np0laiCRKo+KtlQZK7AHgBHg1iA76UMsbflszSadL5+k+vGSqmNr0Fg88Scr5QZS5PCi kUmLLLeNadcTD489Qsd/yAIpCicQivmEqDzM6zg6wpI7QcWmsY05+sST8fQVJdaj7wBY WdZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lSEfcPVLSVdGjudbUJ8Sggq3p7WbAaRsO8gXu0Omim0=; fh=vHhjxHftTECn/hRvIWNlq1eDzDsn74Roqz0kmRcPgcE=; b=coZBevZN8OvEaK+jL1r2KEH8EUvHOQjyrZGHydCZxhHUiN82njSWMmzR4A+Ly4+mUx BSZGx46B+XlYB93K9Vy8X9zkmm9A1Hi5j1Q8mm3sPDupHpyjVaLgmy9ICGNgnXJTBe2E JvTt8oqhA3sllFmSUZVAMw/MOxfvZsbLydPTSPdu/W6QTqoDEbSGqZVQpPCbP0zj87T+ qTzcc0bYMQwjWfSIhZklhSqqsa6xHTn8GdIvdZUr9BS6FDSlcdzjiDLQPcs8rqSef8h2 ajUmoOey/eEkUzprRkNvu/dTa+CAEw9jDzyIlu53q+bcL1e64W6ZyRAongmwrm+0SvZb KNNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wEL1M8P7; spf=pass (google.com: domain of linux-kernel+bounces-1990-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1990-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f9-20020a05620a280900b0077fab003c69si3815992qkp.563.2023.12.15.19.28.32 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 19:28:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1990-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=wEL1M8P7; spf=pass (google.com: domain of linux-kernel+bounces-1990-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1990-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id ED6DA1C248B3 for <ouuuleilei@gmail.com>; Sat, 16 Dec 2023 03:28:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EB5A171B9; Sat, 16 Dec 2023 03:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="wEL1M8P7" X-Original-To: linux-kernel@vger.kernel.org Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EEF012B95 for <linux-kernel@vger.kernel.org>; Sat, 16 Dec 2023 03:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702697229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lSEfcPVLSVdGjudbUJ8Sggq3p7WbAaRsO8gXu0Omim0=; b=wEL1M8P7dGXDYkqa7TZ0623+1nRbflZcjURNMTTrfHumsxxvoj66ZAcvpFCSzlBCmznGOS ShvM+xfySrI3hUK03bi1hMOQo88TQq4lz2lpKcqo9kn0Iqn4roIrmWzq8nWh/E7pzm5vVj gHdLwG+8+qW+yBjQLDhmmlyg1zl3eKY= From: Kent Overstreet <kent.overstreet@linux.dev> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Kent Overstreet <kent.overstreet@linux.dev>, tglx@linutronix.de, x86@kernel.org, tj@kernel.org, peterz@infradead.org, mathieu.desnoyers@efficios.com, paulmck@kernel.org, keescook@chromium.org, dave.hansen@linux.intel.com, mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com, brauner@kernel.org Subject: [PATCH 15/50] kernel/numa.c: Move logging out of numa.h Date: Fri, 15 Dec 2023 22:26:14 -0500 Message-ID: <20231216032651.3553101-5-kent.overstreet@linux.dev> In-Reply-To: <20231216032651.3553101-1-kent.overstreet@linux.dev> References: <20231216024834.3510073-1-kent.overstreet@linux.dev> <20231216032651.3553101-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785407536416750383 X-GMAIL-MSGID: 1785407536416750383 |
Series |
big header dependency cleanup targeting sched.h
|
|
Commit Message
Kent Overstreet
Dec. 16, 2023, 3:26 a.m. UTC
Moving these stub functions to a .c file means we can kill a sched.h
dependency on printk.h.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
include/linux/numa.h | 18 +++++-------------
kernel/Makefile | 1 +
kernel/numa.c | 24 ++++++++++++++++++++++++
3 files changed, 30 insertions(+), 13 deletions(-)
create mode 100644 kernel/numa.c
Comments
On Fri, Dec 15, 2023 at 10:26:14PM -0500, Kent Overstreet wrote: > Moving these stub functions to a .c file means we can kill a sched.h > dependency on printk.h. > > Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> > --- > include/linux/numa.h | 18 +++++------------- > kernel/Makefile | 1 + > kernel/numa.c | 24 ++++++++++++++++++++++++ > 3 files changed, 30 insertions(+), 13 deletions(-) > create mode 100644 kernel/numa.c > > diff --git a/include/linux/numa.h b/include/linux/numa.h > index a904861de800..aeab3d9f57ae 100644 > --- a/include/linux/numa.h > +++ b/include/linux/numa.h > @@ -22,34 +22,26 @@ > #endif > > #ifdef CONFIG_NUMA > -#include <linux/printk.h> > #include <asm/sparsemem.h> > > /* Generic implementation available */ > int numa_nearest_node(int node, unsigned int state); > > #ifndef memory_add_physaddr_to_nid > -static inline int memory_add_physaddr_to_nid(u64 start) > -{ > - pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", > - start); > - return 0; > -} > +int memory_add_physaddr_to_nid(u64 start); > #endif > + > #ifndef phys_to_target_node > -static inline int phys_to_target_node(u64 start) > -{ > - pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", > - start); > - return 0; > -} > +int phys_to_target_node(u64 start); > #endif > + > #ifndef numa_fill_memblks > static inline int __init numa_fill_memblks(u64 start, u64 end) > { > return NUMA_NO_MEMBLK; > } > #endif > + > #else /* !CONFIG_NUMA */ > static inline int numa_nearest_node(int node, unsigned int state) > { > diff --git a/kernel/Makefile b/kernel/Makefile > index 3947122d618b..ce105a5558fc 100644 > --- a/kernel/Makefile > +++ b/kernel/Makefile > @@ -114,6 +114,7 @@ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o > obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o > obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o > obj-$(CONFIG_CFI_CLANG) += cfi.o > +obj-$(CONFIG_NUMA) += numa.o > > obj-$(CONFIG_PERF_EVENTS) += events/ > > diff --git a/kernel/numa.c b/kernel/numa.c > new file mode 100644 > index 000000000000..c24c72f45989 > --- /dev/null > +++ b/kernel/numa.c > @@ -0,0 +1,24 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +#include <linux/printk.h> > +#include <linux/numa.h> > + > +/* Stub functions: */ > + > +#ifndef memory_add_physaddr_to_nid > +int memory_add_physaddr_to_nid(u64 start) > +{ > + pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", > + start); > + return 0; > +} > +#endif > + > +#ifndef phys_to_target_node > +int phys_to_target_node(u64 start) > +{ > + pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", > + start); > + return 0; > +} > +#endif > -- > 2.43.0 > These need EXPORT_SYMBOL_GPL() now like the architecture specific implementations because they are no longer inlined. My arm64 builds fail with: ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/acpi/nfit/nfit.ko] undefined! ERROR: modpost: "phys_to_target_node" [drivers/acpi/nfit/nfit.ko] undefined! ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/virtio/virtio_mem.ko] undefined! ERROR: modpost: "phys_to_target_node" [drivers/dax/dax_cxl.ko] undefined! ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/dax/dax_cxl.ko] undefined! ERROR: modpost: "phys_to_target_node" [drivers/cxl/cxl_acpi.ko] undefined! ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/cxl/cxl_pmem.ko] undefined! ERROR: modpost: "phys_to_target_node" [drivers/cxl/cxl_pmem.ko] undefined! ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/hv/hv_balloon.ko] undefined! Cheers, Nathan
On Tue, Dec 19, 2023 at 09:36:44AM -0700, Nathan Chancellor wrote: > On Fri, Dec 15, 2023 at 10:26:14PM -0500, Kent Overstreet wrote: > These need EXPORT_SYMBOL_GPL() now like the architecture specific > implementations because they are no longer inlined. My arm64 builds fail > with: > > ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/acpi/nfit/nfit.ko] undefined! > ERROR: modpost: "phys_to_target_node" [drivers/acpi/nfit/nfit.ko] undefined! > ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/virtio/virtio_mem.ko] undefined! > ERROR: modpost: "phys_to_target_node" [drivers/dax/dax_cxl.ko] undefined! > ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/dax/dax_cxl.ko] undefined! > ERROR: modpost: "phys_to_target_node" [drivers/cxl/cxl_acpi.ko] undefined! > ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/cxl/cxl_pmem.ko] undefined! > ERROR: modpost: "phys_to_target_node" [drivers/cxl/cxl_pmem.ko] undefined! > ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/hv/hv_balloon.ko] undefined! Applied the following: commit 7ae175e405b44b9897c04bbf177e3e08ab25710a Author: Kent Overstreet <kent.overstreet@linux.dev> Date: Tue Dec 19 16:02:26 2023 -0500 fixup! kernel/numa.c: Move logging out of numa.h diff --git a/kernel/numa.c b/kernel/numa.c index c24c72f45989..67ca6b8585c0 100644 --- a/kernel/numa.c +++ b/kernel/numa.c @@ -12,6 +12,7 @@ int memory_add_physaddr_to_nid(u64 start) start); return 0; } +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); #endif #ifndef phys_to_target_node @@ -21,4 +22,5 @@ int phys_to_target_node(u64 start) start); return 0; } +EXPORT_SYMBOL_GPL(phys_to_target_node); #endif
On Fri, Dec 15, 2023 at 10:26:14PM -0500, Kent Overstreet wrote: > diff --git a/kernel/numa.c b/kernel/numa.c > new file mode 100644 > index 000000000000..c24c72f45989 > --- /dev/null > +++ b/kernel/numa.c Should this be a new file or would these functions fit better in, eg, mempolicy.c which is already built only if CONFIG_NUMA?
On Tue, Dec 19, 2023 at 10:52:33PM +0000, Matthew Wilcox wrote: > On Fri, Dec 15, 2023 at 10:26:14PM -0500, Kent Overstreet wrote: > > diff --git a/kernel/numa.c b/kernel/numa.c > > new file mode 100644 > > index 000000000000..c24c72f45989 > > --- /dev/null > > +++ b/kernel/numa.c > > Should this be a new file or would these functions fit better in, eg, > mempolicy.c which is already built only if CONFIG_NUMA? that does look like a bit of a disorganized dumping ground though, I wonder if anyone would want to start mm/numa/ and do a bit of organizing?
diff --git a/include/linux/numa.h b/include/linux/numa.h index a904861de800..aeab3d9f57ae 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h @@ -22,34 +22,26 @@ #endif #ifdef CONFIG_NUMA -#include <linux/printk.h> #include <asm/sparsemem.h> /* Generic implementation available */ int numa_nearest_node(int node, unsigned int state); #ifndef memory_add_physaddr_to_nid -static inline int memory_add_physaddr_to_nid(u64 start) -{ - pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", - start); - return 0; -} +int memory_add_physaddr_to_nid(u64 start); #endif + #ifndef phys_to_target_node -static inline int phys_to_target_node(u64 start) -{ - pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", - start); - return 0; -} +int phys_to_target_node(u64 start); #endif + #ifndef numa_fill_memblks static inline int __init numa_fill_memblks(u64 start, u64 end) { return NUMA_NO_MEMBLK; } #endif + #else /* !CONFIG_NUMA */ static inline int numa_nearest_node(int node, unsigned int state) { diff --git a/kernel/Makefile b/kernel/Makefile index 3947122d618b..ce105a5558fc 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -114,6 +114,7 @@ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o obj-$(CONFIG_CFI_CLANG) += cfi.o +obj-$(CONFIG_NUMA) += numa.o obj-$(CONFIG_PERF_EVENTS) += events/ diff --git a/kernel/numa.c b/kernel/numa.c new file mode 100644 index 000000000000..c24c72f45989 --- /dev/null +++ b/kernel/numa.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <linux/printk.h> +#include <linux/numa.h> + +/* Stub functions: */ + +#ifndef memory_add_physaddr_to_nid +int memory_add_physaddr_to_nid(u64 start) +{ + pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", + start); + return 0; +} +#endif + +#ifndef phys_to_target_node +int phys_to_target_node(u64 start) +{ + pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", + start); + return 0; +} +#endif