Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2676195iof; Wed, 8 Jun 2022 09:41:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeZDkyc76bVDmnC04+C9kDj/AnK3dndABJtjy9qDudVeonxrlaJHDAUThKh2ax0esSa8nv X-Received: by 2002:a17:90b:17d0:b0:1e3:5324:c465 with SMTP id me16-20020a17090b17d000b001e35324c465mr106352pjb.34.1654706494866; Wed, 08 Jun 2022 09:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654706494; cv=none; d=google.com; s=arc-20160816; b=0yQx+OTr3odV23GSowRUNr0XM23ttIUICEXKoEirv0nkG8BOlYIA8qqXa0+/3mb6D6 ENa3K0zoT2GVcMH1v3DszFD9kDNaXL4C0iCs41tCcsdzuG9Zx8o8mn/PnNHK71QcSE8E /EfM815/DQxP8JvFGTFm97kqK4U4OQSMvtGX59ao8arFW3r6iqrMIpbc+PJS9OpAAUjT 58pmlAlIqkUdNEJqdVmVCYiabJ4TDGmMW+WbKwvGwI4K/RNTVQehFyKjb8e1WBVzbegD hbJxojPQM3tArUYZ250LLhNI5nnSdCvmVCVw3IwEl2+yMKyPIdSmAV92FQJnAZ4tJDkv ZZuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=L08Tp1CQbCugs+3r4OPL8qC4u9Sqe47yIOTWqYhKMag=; b=JIWCfT7GSWCttd3R1pBiL/MDGHI2QkOx0F9KDFW+gSnjBSRwMmJVs0n6AVDHaP3meH nI83YvcWBL8ue4yy9dE2j/GA1Sj5MtJDoGHq0IDJEIBYCRJku2J7XyCdr6arfIWH8g8F vHDprUPWRu7qnLQcBqxBg2yRdF+lKx3QTDZ/hCJrgxl6vx82mBv2xjapzckPMCLJ7k/H svoSsOAB6WoEVkw7Lts6SG6kbPiO+3kCg40FO5gNaBe9L5XF0zsxHlcuYjhTHB2/7aD2 UjsziquNrtHtew9jC8tJVxOXzYj8Es3jM4DJa9KKTW6XYTYUaRaD3HMVFOqQIhMI7vXN xfdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Df9iZPZb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d20-20020a056a0010d400b0050d6ea9b033si30311545pfu.225.2022.06.08.09.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:41:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Df9iZPZb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8060712C940; Wed, 8 Jun 2022 09:14:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245206AbiFHQOf (ORCPT + 99 others); Wed, 8 Jun 2022 12:14:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245229AbiFHQOd (ORCPT ); Wed, 8 Jun 2022 12:14:33 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0600A1216FB for ; Wed, 8 Jun 2022 09:14:32 -0700 (PDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 258FgDDT015241; Wed, 8 Jun 2022 16:14:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=L08Tp1CQbCugs+3r4OPL8qC4u9Sqe47yIOTWqYhKMag=; b=Df9iZPZbSGbYvVI1llYAkGtVIwmok80DEW7alF8DQzvp79nSfRFblDHDz9mebEivkXu3 Srgv4Cwz1yjSOd0ocy2CJUm3wMAm1fJIR7gHCOUZ74ss7AMjnwiA9qmAhPjXTcdWszcQ eGJKUb2O5ApsTrqk4vsdz5oYsJSUyBDe3ndf0tNMTGJPl7UpnBZ3Pbk66HyXKn4a3zfK fasg+6Jn5ph4TJs6adjZyftM3vFt9P0UgpkN34UPXyo7NYA2l90uHzbFo4KwgaaOLixd r355shRNoDbNYm5GB5iOC4kL5T8La1amJNeGyeoSXTDaQa9KHFhExU0eNUndUQ7Cc6NE AQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gjxmvrpdc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 16:14:04 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 258FhSiE017550; Wed, 8 Jun 2022 16:14:04 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gjxmvrpcp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 16:14:03 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 258FofUG002880; Wed, 8 Jun 2022 16:14:01 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3gfy18veq8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Jun 2022 16:14:01 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 258GDfnl20316462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Jun 2022 16:13:41 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 027E952050; Wed, 8 Jun 2022 16:13:59 +0000 (GMT) Received: from [9.43.53.124] (unknown [9.43.53.124]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2497D5204F; Wed, 8 Jun 2022 16:13:53 +0000 (GMT) Message-ID: Date: Wed, 8 Jun 2022 21:43:52 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v5 1/9] mm/demotion: Add support for explicit memory tiers Content-Language: en-US To: Johannes Weiner Cc: linux-mm@kvack.org, akpm@linux-foundation.org, Wei Xu , Huang Ying , Greg Thelen , Yang Shi , Davidlohr Bueso , Tim C Chen , Brice Goglin , Michal Hocko , Linux Kernel Mailing List , Hesham Almatary , Dave Hansen , Jonathan Cameron , Alistair Popple , Dan Williams , Feng Tang , Jagdish Gediya , Baolin Wang , David Rientjes References: <20220603134237.131362-1-aneesh.kumar@linux.ibm.com> <20220603134237.131362-2-aneesh.kumar@linux.ibm.com> From: Aneesh Kumar K V In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 6NXFqf-AbJtKSH1sKB8DHk-E6t4lo61c X-Proofpoint-ORIG-GUID: AD6uJToATxIGkoP82-ZCkHULgLDkSAhx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-08_05,2022-06-07_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 impostorscore=0 clxscore=1015 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206080066 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/8/22 9:25 PM, Johannes Weiner wrote: > Hello, > > On Wed, Jun 08, 2022 at 10:11:31AM -0400, Johannes Weiner wrote: >> On Fri, Jun 03, 2022 at 07:12:29PM +0530, Aneesh Kumar K.V wrote: >>> @@ -0,0 +1,20 @@ >>> +/* SPDX-License-Identifier: GPL-2.0 */ >>> +#ifndef _LINUX_MEMORY_TIERS_H >>> +#define _LINUX_MEMORY_TIERS_H >>> + >>> +#ifdef CONFIG_TIERED_MEMORY >>> + >>> +#define MEMORY_TIER_HBM_GPU 0 >>> +#define MEMORY_TIER_DRAM 1 >>> +#define MEMORY_TIER_PMEM 2 >>> + >>> +#define MEMORY_RANK_HBM_GPU 300 >>> +#define MEMORY_RANK_DRAM 200 >>> +#define MEMORY_RANK_PMEM 100 >>> + >>> +#define DEFAULT_MEMORY_TIER MEMORY_TIER_DRAM >>> +#define MAX_MEMORY_TIERS 3 >> >> I understand the names are somewhat arbitrary, and the tier ID space >> can be expanded down the line by bumping MAX_MEMORY_TIERS. >> >> But starting out with a packed ID space can get quite awkward for >> users when new tiers - especially intermediate tiers - show up in >> existing configurations. I mentioned in the other email that DRAM != >> DRAM, so new tiers seem inevitable already. >> >> It could make sense to start with a bigger address space and spread >> out the list of kernel default tiers a bit within it: >> >> MEMORY_TIER_GPU 0 >> MEMORY_TIER_DRAM 10 >> MEMORY_TIER_PMEM 20 > > Forgive me if I'm asking a question that has been answered. I went > back to earlier threads and couldn't work it out - maybe there were > some off-list discussions? Anyway... > > Why is there a distinction between tier ID and rank? I undestand that > rank was added because tier IDs were too few. But if rank determines > ordering, what is the use of a separate tier ID? IOW, why not make the > tier ID space wider and have the kernel pick a few spread out defaults > based on known hardware, with plenty of headroom to be future proof. > > $ ls tiers > 100 # DEFAULT_TIER > $ cat tiers/100/nodelist > 0-1 # conventional numa nodes > > > > $ grep . tiers/*/nodelist > tiers/100/nodelist:0-1 # conventional numa > tiers/200/nodelist:2 # pmem > > $ grep . nodes/*/tier > nodes/0/tier:100 > nodes/1/tier:100 > nodes/2/tier:200 > > > > $ grep . tiers/*/nodelist > tiers/100/nodelist:0-1,3 > tiers/200/nodelist:2 > > $ echo 300 >nodes/3/tier > $ grep . tiers/*/nodelist > tiers/100/nodelist:0-1 > tiers/200/nodelist:2 > tiers/300/nodelist:3 > > $ echo 200 >nodes/3/tier > $ grep . tiers/*/nodelist > tiers/100/nodelist:0-1 > tiers/200/nodelist:2-3 > > etc. tier ID is also used as device id memtier.dev.id. It was discussed that we would need the ability to change the rank value of a memory tier. If we make rank value same as tier ID or tier device id, we will not be able to support that. -aneesh