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 5060ECD1288 for ; Mon, 1 Apr 2024 23:06:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B28B26B0089; Mon, 1 Apr 2024 19:06:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD84C6B008A; Mon, 1 Apr 2024 19:06:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 978406B008C; Mon, 1 Apr 2024 19:06:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7B5EB6B0089 for ; Mon, 1 Apr 2024 19:06:34 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 45275C04EF for ; Mon, 1 Apr 2024 23:06:34 +0000 (UTC) X-FDA: 81962499108.03.1277CF8 Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by imf17.hostedemail.com (Postfix) with ESMTP id 70E684000C for ; Mon, 1 Apr 2024 23:06:32 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=XFJfR+Hw; spf=pass (imf17.hostedemail.com: domain of horenchuang@bytedance.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=horenchuang@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712012792; 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=O8nGCphDC2lDqE/CSbphHfkuC3TvEewjmAtLy2kdkps=; b=jzAxG564p2mrfUm1gMz4lC9hna/mpIzcp9Vv24A8zhR43EgSBRHY0xR3KShFIr0mk+gnKe j1++hdERNBo6Uu2dDQUPn0QyqW1KhQOvBNptJ1utd81LJfXyAWe53WVTMxP8rTPfYtSWVX 06PnUDlA8Pb34VYZTo3lmX1HD3veYMs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712012792; a=rsa-sha256; cv=none; b=w+p39BDuIzR48AF5d2h1c09YeXIVdXRHxvUDwRxJl94gFGZi+0jyljMS4QX0xCZPhuplnO bvQo/buWi3AONgXifW+FRicuccRPtnd2B/geENEi/6fowyDV8cKc/8SvV2v99F5lMsZZP7 qdGwEfkRKrFW1oPUfLENtpO6DBDjokk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=XFJfR+Hw; spf=pass (imf17.hostedemail.com: domain of horenchuang@bytedance.com designates 209.85.219.175 as permitted sender) smtp.mailfrom=horenchuang@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-dc74435c428so4335303276.2 for ; Mon, 01 Apr 2024 16:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1712012791; x=1712617591; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=O8nGCphDC2lDqE/CSbphHfkuC3TvEewjmAtLy2kdkps=; b=XFJfR+HwvpeRL5Zu1x9hY96b0bq3yRLAjhqPIVFpipdJiWQPo6Ok2BMT7qYmgdqCFd oL+tUC+JI6K9NZQ8lI39Vg2el/nnfdgorcJnx9B37KOnVp0ydhTT+my9pFfRAS1J/KxU LfQh1sSz3Gz2lzWsM9gYtAYUPG8yQyHIH+ap7xStoTau2wuQlgaG2oZve5Z6RqMFVQxX AvBtP/xNK24BmQWxKZ1tBUrIK3BgBp/EqcF4xD4/x+sQ2NapGZ7Fb32hJkyz7TFpsHX7 QsOSYD4kMlzlWa9AhtM4pRP7Ksvt3nw40pybz45fl6NieTb51ahVYCRBLdteX+2qJbaK epvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712012791; x=1712617591; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O8nGCphDC2lDqE/CSbphHfkuC3TvEewjmAtLy2kdkps=; b=YilClOpE2ELwGQbZxHXMzHGIh0dpHqLeZUyZ5/ajKYMyMIqnKby8j74AJDBsfZNnFB NhV8gVtpPJCai4okJu9LZEyfHoMSLuPllfNKG34+uPlPBB9JwpEil2fI0zimydysowqR 2X/VsIyYw4Vdy1vNQjhW5FzHR+BkfzHThP9p9RVmlnhodajoso6YE6h+oz2/K9Y9BKFm Oav+1MyAhLen33BuEbUjWVgylmDA8L3GPIyF2n1KsG7rxjxhrhvk6ISGc7afK2RuUZpx AJJvDCLbZCF9mzd0sLqp5xDuP+3jYnszRvWLvkf4IuqSwGMUWjPh2SZXtOXkuV5Hg5iD E5ow== X-Forwarded-Encrypted: i=1; AJvYcCWvdXRoasyfE/uEkve5Ujy9rQpSXTwQGyv/h44uxFsTT19woCEPpYJ3Q+gB13nPLSPZ3OhOKCnlCGWF5mOTehDewLk= X-Gm-Message-State: AOJu0YwIZzU2VPJqsJrobb6kWajQ5iYqeug5ccJRrOtpZY4drBNz7+ua f1H1bFKv6gAWJnGBTr4pdlOGrDpsBZRJER8owEiJR0sTplIKXj5j26nU8Q/Tv3s7tbh0IRi51YR 57EB0RswBLOv/BK1oV5Vfk77KmbR2kbZC1MaPzg== X-Google-Smtp-Source: AGHT+IHzFkHkXRaCjC8Uy5FTEb4BrGRIOAJ4uvIAnoieQDU096hzOpi7JP+GKKrquqv5tMmb8A6yVyiIs7YwfEUYlA0= X-Received: by 2002:a25:bb51:0:b0:dcf:30d9:1d7b with SMTP id b17-20020a25bb51000000b00dcf30d91d7bmr9194408ybk.45.1712012791583; Mon, 01 Apr 2024 16:06:31 -0700 (PDT) MIME-Version: 1.0 References: <20240329053353.309557-2-horenchuang@bytedance.com> <20240331190857.132490-1-sj@kernel.org> In-Reply-To: From: "Ho-Ren (Jack) Chuang" Date: Mon, 1 Apr 2024 16:06:21 -0700 Message-ID: Subject: Re: [External] Re: [PATCH v9 1/2] memory tier: dax/kmem: introduce an abstract layer for finding, allocating, and putting memory types To: SeongJae Park Cc: "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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: 9xjo7co7e7bzp78dweb33axkupbqtucg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 70E684000C X-Rspam-User: X-HE-Tag: 1712012792-520946 X-HE-Meta: U2FsdGVkX1/gfBI3cABtShhXpU6Rgp+OZ0PB1yaMXg4KoJIgSfvG6rHqi9Mv8ma1Kz4BNBZrHpOJbUNcsb0fRsslGGz0XLbvAJ/AdnPhfMc9Ss5DlWXsaqE7RecaJs7/QiCRo1UFwH9tFCVxHghC1sbu2giQL5/cHJYsYpJkw+o4ksmt1phWCLkIQg2yITOCh7hDraGSIYHO0TGz7AHWYyyq8gXrTBLW9PW7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9wn882Y8LzoyOOmDanjG93nvPlAnHwfqntuLcsy7wDjPEDQQjNN/U29goa60tnE9RFkEvMnTq7Bf1oCC6meK4PS1RqLtKBPla4tdDUjJUQSnsBZUK2wHmc1bHy3S9ANG85XPOArklyANi0TVubJ5YFd5BX+hzYXKVuTfNQ= 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 SeongJae, On Mon, Apr 1, 2024 at 11:27=E2=80=AFAM Ho-Ren (Jack) Chuang wrote: > > Hi SeongJae, > > On Sun, Mar 31, 2024 at 12:09=E2=80=AFPM SeongJae Park wr= ote: > > > > 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 putti= ng > > > 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-tier= s.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_hea= d *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 ac= cess_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 bis= ect' > > 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=3Dum O=3D../kunit.out/ olddefconfig > > Building with: > > $ make ARCH=3Dum O=3D../kunit.out/ --jobs=3D36 > > ERROR:root:In file included from .../mm/memory.c:71: > > .../include/linux/memory-tiers.h:143:25: warning: no previous proto= type for =E2=80=98mt_find_alloc_memory_type=E2=80=99 [-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 protot= ype for =E2=80=98mt_put_memory_types=E2=80=99 [-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? > > > > Thanks for catching this. I'm trying to figure out this problem. Will get= back. > These kunit compilation errors can be solved by adding `static inline` to the two complaining functions, the same solution you mentioned earlier. I've also tested on my end and I will send out a V10 soon. Thank you again! > > > > 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 acc= ess_coordinate *perf, int *adis > > return -EIO; > > } > > > > -struct memory_dev_type *mt_find_alloc_memory_type(int adist, struct li= st_head *memory_types) > > +static inline struct memory_dev_type *mt_find_alloc_memory_type(int ad= ist, 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 > > > > -- > Best regards, > Ho-Ren (Jack) Chuang > =E8=8E=8A=E8=B3=80=E4=BB=BB --=20 Best regards, Ho-Ren (Jack) Chuang =E8=8E=8A=E8=B3=80=E4=BB=BB