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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47F0FCD1284 for ; Sun, 31 Mar 2024 19:09:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E1CB6B0082; Sun, 31 Mar 2024 15:09:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6924C6B0083; Sun, 31 Mar 2024 15:09:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 580626B0085; Sun, 31 Mar 2024 15:09:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3BC196B0082 for ; Sun, 31 Mar 2024 15:09:08 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BBACE1A0334 for ; Sun, 31 Mar 2024 19:09:07 +0000 (UTC) X-FDA: 81958271934.01.FC889F7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf10.hostedemail.com (Postfix) with ESMTP id 8D038C0002 for ; Sun, 31 Mar 2024 19:09:05 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EkdU9EiU; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711912146; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NwGuLmDX/8wL/v+yuDMp5ogAEf89m+KATaqCJ8hJ+3M=; b=Mg12D3iaGYiGWHlnX6aioxUH7UWwtMYcHU6XELyfdzS3Vx4wo7IFN774Wciv4qdib9XM2u lWhjVXqgR+rmSteSahFZewQOBAuMvw/KEoPm63JcrZcurbTdlPjIp7zP+xpjVlZTlPeoXj 9nsICVr7HIIrx9GzUisMW3JFUBIq6Nc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EkdU9EiU; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711912146; a=rsa-sha256; cv=none; b=Imq4Ml3XXIBwoVVRWS+dqLMIJW8leleoFfYRwTG6usnDzNbgnzDfxzhzHSxq8WQMjNFs/n 2I7BMVFY20wLfXrX/1YvvEq7Fjp6+89sTNkryRxMvHdPqq5sALuiP422Uy9f36b/07nytk xXDYlwMLn8D0EJY6gaJ7TnEhKfiUFeo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 1694FCE0B3B; Sun, 31 Mar 2024 19:09:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 348A7C433C7; Sun, 31 Mar 2024 19:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711912140; bh=v/zuC8dt4PV8gMPcCnVwh1IagNNndASoACR2DPKF6zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EkdU9EiU/fOn+VGtH/tMC4xLPQef/k8wjFWti0XMQjY0ZC+CwZadjgwdsOnuiSFvw xPviXDAw+R09SJt/zL1282C9RYbrWZujNgIu13gna1VsZUMsilrog1MuCyndMg90jK lSN7+qQFSB18Qru/PmhPexFbSbL/AZ6BJLjFFB49RRi2WZvV/NX00if0UIeggw3ap/ aCdVgYMQmXvS2iKJAx+VPbDgaQjccZ+aQPZbOtAsmH8KrnMRMqubWTturx7IEni3/d oWhO8Gsuegc5AQVQDzgSjEth8LXHD3AnBaFIz6b41Onab2Mhk+86ujvXyomS1dCkke 6DLAsl7U8CMRg== From: SeongJae Park To: "Ho-Ren (Jack) Chuang" Cc: SeongJae Park , "Huang, Ying" , "Gregory Price" , aneesh.kumar@linux.ibm.com, mhocko@suse.com, tj@kernel.org, john@jagalactic.com, "Eishan Mirakhur" , "Vinicius Tavares Petrucci" , "Ravis OpenSrc" , "Alistair Popple" , "Srinivasulu Thanneeru" , Dan Williams , Vishal Verma , Dave Jiang , Andrew Morton , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Ho-Ren (Jack) Chuang" , "Ho-Ren (Jack) Chuang" , qemu-devel@nongnu.org Subject: Re: [PATCH v9 1/2] memory tier: dax/kmem: introduce an abstract layer for finding, allocating, and putting memory types Date: Sun, 31 Mar 2024 12:08:57 -0700 Message-Id: <20240331190857.132490-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240329053353.309557-2-horenchuang@bytedance.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8D038C0002 X-Rspam-User: X-Stat-Signature: 5jafe6aimmex5hm31nudratmmsmit96u X-Rspamd-Server: rspam01 X-HE-Tag: 1711912145-50109 X-HE-Meta: U2FsdGVkX18pgaqXyxcWCc/hW+jCsgQYs+oMFiBumTLDfPbjKGSi924kv0aJznjMQRTpLYDJPcfFg6pvH0CvRVP7gHskOl9Inq2hrLYUxjx+/CaGv27aL3fxyoDIqnz81IuW2fxLfAOtK+NUUg1OcPynBIo5sLLJiezgKds2KXXHHUepy+XpZgYadRfkht6+ai3Gi0k6l/+rPYeavKMv579lPvaNm47xhMeCHSQLVW1V//OEiv1Ei/ND9eEDwbMxVP1Afhtvb2KIQpBp5e7J5UAyfv1QWBpTiW7TUNZgmCYJefA9BFTBCrp21rZrFFy7+LxQo/lGkiUqH7eNYnYJ1ZDNZJNr+9GUUXZAOdNVLSxqWgiQRFvoQyMUn6hOfff3Tl+BBPyqlRWblmTxBjEMPYdp2NP/8DXXD5ucG/vUbyPEA0+ibZe0XGBEwNzpYNR7GRZJSfZ+n+g4kgXMmTq89GZHhBOUb3Rt1ngR3zpc6wjRCIFpxzcV8NP1NVkAoxeJLDsv44fthrCsrYHBZqt8bEaRuXXArhrK1h62z7DpP3f/iavvU4PwJJb/2E3O3El1WmiLfv0Du5UJxSOvmr/myxQ0WPXhCYwCyPPRKoOWkfS3aDMspcNBN8GLHTokpB5zT/FWSIlplq0d9M3KltXTOMPrSdZ5IGO/dWy/vJO8BOeCpNkl2ziGY2TB5728Few+uu2gPJupPOmMnYtBCh/r8epcWrpPWLySsK61grp/o0Sehmw1/MwTgMtXPuLgKVbiLu5E5EXNHbixaQWFDY100Dea3ci5zPss8DtcjKUQ6qiHu2ALgPhTa0GycIq2YkIRFZJSMvgPEINn+Rp2nJ2wBM423VDm/CfcRPGdP1BWKJwcKrXsL0lyrrXRYKBbVW73LmHa3FafErnhvIDV2rbXIhR/eheQivkXApbVoYuvcAqVSJdNxOLCOzcGqD2OVvSLVtakN8SP87dBki5/jal WHQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Ho-Ren, On Fri, 29 Mar 2024 05:33:52 +0000 "Ho-Ren (Jack) Chuang" wrote: > Since different memory devices require finding, allocating, and putting > memory types, these common steps are abstracted in this patch, > enhancing the scalability and conciseness of the code. > > Signed-off-by: Ho-Ren (Jack) Chuang > Reviewed-by: "Huang, Ying" > --- > drivers/dax/kmem.c | 20 ++------------------ > include/linux/memory-tiers.h | 13 +++++++++++++ > mm/memory-tiers.c | 32 ++++++++++++++++++++++++++++++++ > 3 files changed, 47 insertions(+), 18 deletions(-) > [...] > diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h > index 69e781900082..a44c03c2ba3a 100644 > --- a/include/linux/memory-tiers.h > +++ b/include/linux/memory-tiers.h > @@ -48,6 +48,9 @@ int mt_calc_adistance(int node, int *adist); > int mt_set_default_dram_perf(int nid, struct access_coordinate *perf, > const char *source); > int mt_perf_to_adistance(struct access_coordinate *perf, int *adist); > +struct memory_dev_type *mt_find_alloc_memory_type(int adist, > + struct list_head *memory_types); > +void mt_put_memory_types(struct list_head *memory_types); > #ifdef CONFIG_MIGRATION > int next_demotion_node(int node); > void node_get_allowed_targets(pg_data_t *pgdat, nodemask_t *targets); > @@ -136,5 +139,15 @@ static inline int mt_perf_to_adistance(struct access_coordinate *perf, int *adis > { > return -EIO; > } > + > +struct memory_dev_type *mt_find_alloc_memory_type(int adist, struct list_head *memory_types) > +{ > + return NULL; > +} > + > +void mt_put_memory_types(struct list_head *memory_types) > +{ > + > +} I found latest mm-unstable tree is failing kunit as below, and 'git bisect' says it happens from this patch. $ ./tools/testing/kunit/kunit.py run --build_dir ../kunit.out/ [11:56:40] Configuring KUnit Kernel ... [11:56:40] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=../kunit.out/ olddefconfig Building with: $ make ARCH=um O=../kunit.out/ --jobs=36 ERROR:root:In file included from .../mm/memory.c:71: .../include/linux/memory-tiers.h:143:25: warning: no previous prototype for ‘mt_find_alloc_memory_type’ [-Wmissing-prototypes] 143 | struct memory_dev_type *mt_find_alloc_memory_type(int adist, struct list_head *memory_types) | ^~~~~~~~~~~~~~~~~~~~~~~~~ .../include/linux/memory-tiers.h:148:6: warning: no previous prototype for ‘mt_put_memory_types’ [-Wmissing-prototypes] 148 | void mt_put_memory_types(struct list_head *memory_types) | ^~~~~~~~~~~~~~~~~~~ [...] Maybe we should set these as 'static inline', like below? I confirmed this fixes the kunit error. May I ask your opinion? diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h index a44c03c2ba3a..ee6e53144156 100644 --- a/include/linux/memory-tiers.h +++ b/include/linux/memory-tiers.h @@ -140,12 +140,12 @@ static inline int mt_perf_to_adistance(struct access_coordinate *perf, int *adis return -EIO; } -struct memory_dev_type *mt_find_alloc_memory_type(int adist, struct list_head *memory_types) +static inline struct memory_dev_type *mt_find_alloc_memory_type(int adist, struct list_head *memory_types) { return NULL; } -void mt_put_memory_types(struct list_head *memory_types) +static inline void mt_put_memory_types(struct list_head *memory_types) { } Thanks, SJ