Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1614698lqz; Mon, 1 Apr 2024 11:27:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7UbLHv3+LPSzETN2YiNFnEnEr/i2EgZ37AMrJjb27gi7opVCSa61jvFjjP6E/YVzDmG1gECoDdlZsopvQZdaLctEn48RNMdFX/F1kzA== X-Google-Smtp-Source: AGHT+IFVwyE/qB95YRoKVLq3omP22FtkjfRl3NJy1wm8szNrQurkbLUHnqjPg0R33u/3zzuMCfWJ X-Received: by 2002:a17:906:f1d0:b0:a4e:4f58:c2bc with SMTP id gx16-20020a170906f1d000b00a4e4f58c2bcmr4399631ejb.14.1711996069571; Mon, 01 Apr 2024 11:27:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711996069; cv=pass; d=google.com; s=arc-20160816; b=Hq2Z+4AWX1XBg2CPc3wL47XyoEmWIjrW7gdAWqkxjXOlFWde6zvNLx8GOurKIk3RIR BuxnmHm57YA92Ed8IA8dLlszjcqeVOzmUZS4ovM+im7qBHHmo7r2/SjR0QSMzhCbz9N6 WWaE8EcNPH42eyepa6V8SYar7SFNY/8lm56zM2eiz6PMsEdl7X7JH61ImMYXtWd5a3BX MB0dqhIVDxljX+PeXFzL1aXHrWIa6RRyLS1xQO0gdtEknpTEi/mI75n5XS51Y0l8qMD2 wBgKsExa/0CPn4izM1+ZIyLfuxckJhZJlzVBgUd+kbrdw77IMmitnhHlfiZoztM7NaR4 3ijw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ncAfdDQGFs7+0XI6NTF6RR9ikr8USButMq6raz2KWU4=; fh=qHlvfDftkXB5c4tH9WF4G6DO0fVGKNrgLYNYTsdDl5w=; b=xXfNbLLV7bkZElDexxtEKaPZ6hxhnp4QmndFwcjOqs0Co9QQqlj8w+UR5Zj1codOCV iWBt3OET2PB1+2MQCRFMpiC2BPKB67dPJVMnkQOMo4YrfPnTzx6pGF3YsCJ8EOLmX6Hu /Uvd3Zn9k/tXNaZgX1KbtwyDIT0LaByfRZw8sc9AN7Ldl8LF4ltLzQa+2oSlnJJG/a6R 9Vzg+EdG2bynZEdLShVup9I2nhowVTgg6nDHdF+YaTT9Bd/XgtLz6Ab4Du8RHPZR98OW yJoCRBm6MeGWH+ROgMUdmg4Hc4WJcU2L9Nx+xebTF+cUKnmhc3onWzQuUlgWz6p9nBCl 2JEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=SURu4DR8; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-126951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dc17-20020a170906c7d100b00a46a1d18659si4752488ejb.581.2024.04.01.11.27.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 11:27:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=SURu4DR8; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-126951-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126951-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 230C61F211DF for ; Mon, 1 Apr 2024 18:27:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B9FD50278; Mon, 1 Apr 2024 18:27:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="SURu4DR8" Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 927164B5CD for ; Mon, 1 Apr 2024 18:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711996057; cv=none; b=OFlmoriLUjjfqUVHwsxoyL/4/y4n+K7lz1A/QcR3KmhB3KmVmVApzWR2KeCo7Btx8r8+mllEdo8Rr446gfuQSOK5PJ0Sn5bFafpaYGGAzlf8OZZ2VpLyUabDCRF/8lSK4shiQz5bB0Obhb7gH32M/IMddEqOP9gQUY/nZaRj8xk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711996057; c=relaxed/simple; bh=k4SXXcm2mz8yX6Tn9J6bfnKNwZT38ARoeA60Km6CYJM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Kvvwkle24fwlJwksqb7LABo7cs7QCpiTWitgE3nd8Hl2JC/161M13znvMxWzdojSWRWn6fwCmwrVj0DOzQHlWHOO4bFvdZyP/pgyTfodjA1NNwAkb219umv67WW91GoYoGsEzfneUHTkz/IV1auKutIgMjvmeqKJp97AB02qsM8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=SURu4DR8; arc=none smtp.client-ip=209.85.219.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-dd045349d42so3748486276.2 for ; Mon, 01 Apr 2024 11:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1711996053; x=1712600853; darn=vger.kernel.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=ncAfdDQGFs7+0XI6NTF6RR9ikr8USButMq6raz2KWU4=; b=SURu4DR8KTJLezTXgLAoS44arr9coAJ5mbSW/ys1riOKo8VhbGn0XOeO4kmGv6aBok fdb4MFxSF+OFPtzCPcLK1Jn+4HZxqytuuFkFRecMOsJdhHOl4EbzpPJdk88COqUiiv9/ Tc+OJhyuZQi41wOgEmXVZKEXkH2p08U+gLXI06xtjQ0ogCu1rGJO2wrkY8fafxr3SOah pG121ITYixTAJ8l9p5Gfm3+QkgUt77iR8UEu8b2lWxC91UST6+vtyfVKLbpUKjHWsDXF NYRvQ4Zf0DpbJLpU7OTO3Kp8LBwl+7cJyUeieV+PvQfE4zjhoIV2ucZZr3bfKQ/STbAX oJdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711996053; x=1712600853; 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=ncAfdDQGFs7+0XI6NTF6RR9ikr8USButMq6raz2KWU4=; b=D67WEb5k3zg1rL0yPJtjguhokJZj2s5gcnuKmQQZfFl9HQMHsnz4Kra7ZU0HhnwJ// eiyi6hRjcUxx77chXU4nne7I3z01kt+bpJxUL7QCVccjpyhNJW3FzD0dk753f+Sd8leW DtwGRSNAtA9+9ZFFscR94yoYAGhaB1hCmGra8xGiUudUXmd0O5/KF4fDbx1aJy38Lo58 7kcYEUj4fRQNLRzgjF9pVnuTrsF+rsM+68NibZiyK1f24UI8pWwL+CjK2K7OI618I/nr WJNs2whtTYV9GKcZ0buHcETExchuLzWM4oINSBMLA6TPp7j9bjKiPH5zsTMoK7uipKj5 5RUA== X-Forwarded-Encrypted: i=1; AJvYcCWkA15mQpPWZIiWsvg5LjVLmgitOc1IrrKR5bNMFE2BapQ4h/kMLRcuvgiNWVEN6XLJdv1KoAVMuGiYebR4w1mNjEOWiz754mS10NIp X-Gm-Message-State: AOJu0YyTOtFRc1uk82oV1NFsFO46ocGZsn3ntjU4Je6hX1lE/GJr3vVP 5zl7VWD696OPibq0TSdSWYlAWPpD8+iXbimjQZfUrlPgBV5k0OqOp9q50Gsye5Bp2ddPXRcSwUT SKx1ZTmMcl7nSuDt6NzrbiD4bRkpT4Y+uvkL0Qw== X-Received: by 2002:a25:ff12:0:b0:dc6:d7b6:cce9 with SMTP id c18-20020a25ff12000000b00dc6d7b6cce9mr7881129ybe.57.1711996053583; Mon, 01 Apr 2024 11:27:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240329053353.309557-2-horenchuang@bytedance.com> <20240331190857.132490-1-sj@kernel.org> In-Reply-To: <20240331190857.132490-1-sj@kernel.org> From: "Ho-Ren (Jack) Chuang" Date: Mon, 1 Apr 2024 11:27:23 -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 Hi SeongJae, On Sun, Mar 31, 2024 at 12:09=E2=80=AFPM SeongJae Park wrot= e: > > 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 acce= ss_coordinate *perf, int *adis > > { > > return -EIO; > > } > > + > > +struct memory_dev_type *mt_find_alloc_memory_type(int adist, struct li= st_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 bisec= t' > 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 prototy= pe 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 prototyp= e 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 th= is > fixes the kunit error. May I ask your opinion? > Thanks for catching this. I'm trying to figure out this problem. Will get b= ack. > > 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 acces= s_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 adis= t, 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 --=20 Best regards, Ho-Ren (Jack) Chuang =E8=8E=8A=E8=B3=80=E4=BB=BB