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 B66F9C41513 for ; Thu, 4 Jul 2024 17:11:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F2046B009D; Thu, 4 Jul 2024 13:11:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A2816B009E; Thu, 4 Jul 2024 13:11:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3914C6B009F; Thu, 4 Jul 2024 13:11:03 -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 1B6666B009D for ; Thu, 4 Jul 2024 13:11:03 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 945D941489 for ; Thu, 4 Jul 2024 17:11:02 +0000 (UTC) X-FDA: 82302710364.12.11A262A Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf29.hostedemail.com (Postfix) with ESMTP id 85337120015 for ; Thu, 4 Jul 2024 17:11:00 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720113048; 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; bh=D80XTlkGFE5DLDyGR2Vsp+sJZcm9vd02OObQNh1auYM=; b=QqqtpK/KqY9WCuBQwlfT3V65ojvq+gKlVkgDokLRFliCe/hTKTEt6VvDiTsRXqknWRtlV9 4+DO3vcULVlDv5yvy93I+PlgaSfA1s1ErKuUEkeVxyA91T249Mpl0FztPUdfO2eSEAe0et O21lQ+XM/qqHC6nkUpE3XW3j8HlCvto= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720113048; a=rsa-sha256; cv=none; b=N3fDO5pY68XjCwIWiz4JJqovuFMyDir0c48aOksdiPtiW+j4M0risK3aHboc0uxHr6POKj 5v2zwrT6csnICDBj9AkAMicftpbNEFjXwyywRrkhhlr9VquvR+jT61nxVMxap/CykvGONO /uyaBgjI1Tce6Auik9/o84iVLFhcuPQ= Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WFNSQ1d8dz6JBH9; Fri, 5 Jul 2024 01:10:14 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 1FEEC1409EA; Fri, 5 Jul 2024 01:10:56 +0800 (CST) Received: from localhost (10.203.174.77) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 4 Jul 2024 18:10:55 +0100 Date: Thu, 4 Jul 2024 18:10:54 +0100 From: Jonathan Cameron To: "Ho-Ren (Jack) Chuang" CC: "Huang, Ying" , Gregory Price , , , , , Eishan Mirakhur , Vinicius Tavares Petrucci , Ravis OpenSrc , Alistair Popple , Srinivasulu Thanneeru , SeongJae Park , "Rafael J. Wysocki" , Len Brown , Andrew Morton , Dave Jiang , "Dan Williams" , , , , "Ho-Ren (Jack) Chuang" , "Ho-Ren (Jack) Chuang" , "Ho-Ren (Jack) Chuang" , , Subject: Re: [PATCH v3] memory tier: consolidate the initialization of memory tiers Message-ID: <20240704181054.00001f67@Huawei.com> In-Reply-To: <20240704072646.437579-1-horen.chuang@linux.dev> References: <20240704072646.437579-1-horen.chuang@linux.dev> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.174.77] X-ClientProxiedBy: lhrpeml500002.china.huawei.com (7.191.160.78) To lhrpeml500005.china.huawei.com (7.191.163.240) X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 85337120015 X-Stat-Signature: nr5r3z1xfgfjch3f13zyqm5mad9indts X-HE-Tag: 1720113060-185578 X-HE-Meta: U2FsdGVkX1/FKl5sp6hnxsMHctkO9T9VIj0dhOfPCYG8auOBl1Ul9QLuhHlf0UQXpW7+uSMdRcEJJaqBAYgHawJXLxYVKp1YmUiocJOLsZ0v1MliKGSp9Ynfr1HbNdQTeeA+R3c86jT4kAMbvNLH/72IlaK9MGqRR/1E+H8gAvGXi+gOl5Dcv+ywhv+Inj+cVoaYwpYijEt8jh5dgXyTjP8sSY5POdsqNbjgMPRzedPfsHcpB/9XXZUATMuO2hgR+tQCo5xEFS3/iDnpFCUHuF7zHPpqoex76m3c6755qvwDHFjY6MCDVdfW0A/rMPhqRMDa8rhd2aYVqDFtbuIJLwEtEAc4hAuUEjhSKpjmGLHSrBBNo1j9dajn5GwIW1GpfKXEKrBCJi9ZizCHs8x4WUTQGgWiqGL3QuB2JXnngRrTuHBFeR9TXoVCtyqHqw/k8H+xyBtzr1otiVYXa7GknEpnDpNnj05ci4lCAo4fiNDkT4aNs5ZbOtg9J8v4vBq4dC2jp4hCgG9Zn6i1VgMF4X0s2wEKtBWydpdrMXsyR+gEbt/iZUG0hT9P1OUvswJHax/Yc0JaMiMSMN1w//raQfBhJLicAx+A2UEBoOtVxyzwTKgqcdqbhTbRVjFMiaa184E7qyFhB30ASmINSzOXRHlGKKdvP3NlURFlRwl1RRNj+y16Zh2CizamAVvyPHq/x+T6ftCmIo4NDhOZr4JbMsy65/MMkIQEkMRgLUoIN6h0LgUj4rnNHo/ZTDAJDlV5ST7Ch0gc3HF46gSR+8ysoakhiCyVZ5HBWlBBrAQ0idcHhCg1IasgdCBERv9ZW/HEnC+Wq6kMMjfufK0zBI+DZgD0bnkEAIS3q4fjPexhGu7GwAw4yEEbb7bSiGMSOm9P64+Os7Nua4uNpqDIrIJbmMAnBsRE7mAuZEaCcV1Ag5nWnAlTV7jFV6f4BLetg8afBs7Hr1rLFd3uNMTZq3v t4Ncg2I9 bOO/ZoPr/7OTGOIOGZ/Rr7Fod++hnMekbbIOy/pjee+tMQcHVXmxJiTHMq9xJmgyZuFxxSLPQMCqQ0m1aJTz/iwqwv3BKmiKTAOr2Jagofgwx9XZz1JUFSkVPIzMJEWxFeIRg5OEA6eyi6VeB3ch7a2agRBq948OQeezh9HfepuoK8SrqIEA7F4BBilte2C9mXQ6i/dv3jbOmkrTWN/RXoNI1hQkhCEw79/ZYFa2+N7Unhd3/SQL5nLjyVTi9IlWY64Qg6t7A5gYi6Itnl9ie1bi6uRxPSsPJmeKAKFJ0iT/DouVWfWZY27qCKMyQ51c7zLItAVqbcjB0xdYvwMpbiuueQ5QyVKtam5keG/4zhFNqw52YDNhMd4BZiSGlRmNxTLDfj5r2GXYUHDfYD4dQPN9h9MjhuvUmmzuZ 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: On Thu, 4 Jul 2024 07:26:44 +0000 "Ho-Ren (Jack) Chuang" wrote: > The current memory tier initialization process is distributed across > two different functions, memory_tier_init() and memory_tier_late_init(). > This design is hard to maintain. Thus, this patch is proposed to reduce > the possible code paths by consolidating different > initialization patches into one. > > The earlier discussion with Jonathan and Ying is listed here: > https://lore.kernel.org/lkml/20240405150244.00004b49@Huawei.com/ > > If we want to put these two initializations together, they must be > placed together in the later function. Because only at that time, > the HMAT information will be ready, adist between nodes can be > calculated, and memory tiering can be established based on the adist. > So we position the initialization at memory_tier_init() to the > memory_tier_late_init() call. Moreover, it's natural to keep > memory_tier initialization in drivers at device_initcall() level. > > If we simply move the set_node_memory_tier() from memory_tier_init() > to late_initcall(), it will result in HMAT not registering > the mt_adistance_algorithm callback function, because > set_node_memory_tier() is not performed during the memory tiering > initialization phase, leading to a lack of correct default_dram > information. > > Therefore, we introduced a nodemask to pass the information of the > default DRAM nodes. The reason for not choosing to reuse > default_dram_type->nodes is that it is not clean enough. So in the end, > we use a __initdata variable, which is a variable that is released once > initialization is complete, including both CPU and memory nodes for HMAT > to iterate through. > > This patchset is based on commits ("memory tier: create > CPUless memory tiers after obtaining HMAT info") and > ("memory tier: dax/kmem: introduce an abstract layer for > finding, allocating, and putting memory types"): > [0/2] https://lkml.kernel.org/r/20240405000707.2670063-1-horenchuang@bytedance.com > [1/2] https://lkml.kernel.org/r/20240405000707.2670063-2-horenchuang@bytedance.com > [1/2] https://lkml.kernel.org/r/20240405000707.2670063-3-horenchuang@bytedance.com > > Signed-off-by: Ho-Ren (Jack) Chuang > Suggested-by: Jonathan Cameron LGTM Reviewed-by: Jonathan Cameron