Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp651212ioo; Thu, 26 May 2022 11:21:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0I6SIqy15kTE2xmy6RlR+40WpcBYjEUwD/HneKkfilZ2A4ReWT4uy3NZTOaNr6NwwobNh X-Received: by 2002:a17:907:2ce4:b0:6fe:b0b3:c915 with SMTP id hz4-20020a1709072ce400b006feb0b3c915mr441170ejc.252.1653589262730; Thu, 26 May 2022 11:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653589262; cv=none; d=google.com; s=arc-20160816; b=ldojrqHEmqgKSUgMU/irCBEIVhgwky0yHhnkdGf56gxHtjA4A1Egw1sUz5mPQuZJmR XB9CvqGxXwieCEbttzDzGwmii9ZKsu2qwayqx8xQAUSZoW2gWartl5NYQssu62FTF9e0 Cktqz9Y6nOKXNxi4JDp/qgTztbciRLmrOFU/xCF4/kF8kCXAyZnFBD/Z3/wBQ6VURq/L gLQ/mjRAJLQg2lyWx0cFQsjcMaPu7Shqu7MumP/pXBNZ8lqcYz15+iQKGnUijnIsPMEF XYIysQ7OxF2E2szNmc3D7pMMIeUBlojmuXk14trrZ0ocFjUxatNCzitA0w7+PAs8AQn7 bidw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=V6fNtaXrpXPdwdoGVh0BHVRTyE3sTb/7nc/NM05nCe0=; b=w89v3uMp7ktsgtInLck4WoNVExjOH1nzz1w5lh0j3KOX00Z93EXJftjh5ulu6UApgp FH0OdJ73cnBYdqGidqxdStMOeztynWMFYVhJH1TkWRW1ngrCCS9Gi/Cnr88JbA7MO4pc n7NG5by44erXr4DHnaT1cOxug5giBiOlZ/DN5/3R9okjwl/D/PO+HmWo8CydHgJKVwWs Ajg26UZwWDkrasZKTsw65DgEKhFMprPAqfS2++N9lXdPl+uTLBPm0KrH8zWx8/LBkkXQ IvkEAUfzkI4EjtXN8/mDtH1cMnYKMyjXIaZDX+32+dG/wWRGnu5g8MJ8n9dqqEZ/gFqi WkNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=oQsvSC8o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i12-20020a170906698c00b006febef95910si2033979ejr.332.2022.05.26.11.20.20; Thu, 26 May 2022 11:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=oQsvSC8o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244611AbiEYPcz (ORCPT + 99 others); Wed, 25 May 2022 11:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbiEYPct (ORCPT ); Wed, 25 May 2022 11:32:49 -0400 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BC93A473 for ; Wed, 25 May 2022 08:32:45 -0700 (PDT) Received: by mail-vs1-xe34.google.com with SMTP id w10so19271062vsa.4 for ; Wed, 25 May 2022 08:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V6fNtaXrpXPdwdoGVh0BHVRTyE3sTb/7nc/NM05nCe0=; b=oQsvSC8oEHuqSFLW0whM02wczKQrPEEyRwIDRWwKX2XQlCFjJgF1jeOh3dWrRdAhxz 5QNtkOQPmwuEEU4WUXD6nT8XpGKYuGjk+lxGtK+D+45zA4+MJqiez/ARh+JvFvf3/sqO X7qsNSRhDYk71RwEdVZunX92MESwEbYDHgHjBUDmVlq4/jQkfMvHEJltFjx15HUWOQms nyHD80H+FKu+bcFqd4WGgRowmWb4MrB7vtNFuMp0w0xQq85Xx6egFuyCJ768m8KyqjiQ pm+TrxzQWv5tK1z/uLYkU9kG7wE2Ikibo0FMRjl1dDZJpmBpvnyW6ZNniXd3QO+RQfa1 UJ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V6fNtaXrpXPdwdoGVh0BHVRTyE3sTb/7nc/NM05nCe0=; b=z7DHS8gma3niPK1kji6KhRJtZUHLVjujbIW/QiiF5l6sMHcVARK52zi4o58zhvNSUz lvs0t1ePWyj3jTfRvZmFNMI2BUFt0h2tsXRk5HI09lt8Oo8gJjhor5i3rug0yjRXasVJ cYzVTSNHQAVuS2U6tppsUoLNfCAuh3UZFYvPWyZhRl9Q0NHi4D2n/pVRF2eM4JVKNgMB CcUi2JgWUVaa3IxYsRfkOUSvF6bGu9cr1kQc7KDCyavjVhrYN1WN5HSc7CqPYZ3JVfls Lqle4fnG+EETvzMQOYquJfCUXVRRYzxgE3oPL8tGImxxiQI2RNE3T5A2B12TRR6Rb9IL mH/g== X-Gm-Message-State: AOAM531EXRpzNSQzotvLC/nJqJb6IsxNlQZ7TeivUW4YWbUBYHITShqi 9eR3qltFin5qiUoYipEu0sd8hbpPLII5U/l297D3Vg== X-Received: by 2002:a67:ed88:0:b0:328:27d9:1381 with SMTP id d8-20020a67ed88000000b0032827d91381mr13563848vsp.12.1653492764752; Wed, 25 May 2022 08:32:44 -0700 (PDT) MIME-Version: 1.0 References: <20220512160010.00005bc4@Huawei.com> <20220518130037.00001cce@Huawei.com> <8735gzdpsx.fsf@linux.ibm.com> <87h75ef3y5.fsf@nvdebian.thelocal> <20220525124847.00007a16@Huawei.com> In-Reply-To: <20220525124847.00007a16@Huawei.com> From: Wei Xu Date: Wed, 25 May 2022 08:32:33 -0700 Message-ID: Subject: Re: RFC: Memory Tiering Kernel Interfaces (v2) To: Jonathan Cameron Cc: Alistair Popple , "Aneesh Kumar K.V" , Dave Hansen , Huang Ying , Andrew Morton , Greg Thelen , Yang Shi , Linux Kernel Mailing List , Jagdish Gediya , Michal Hocko , Tim C Chen , Baolin Wang , Feng Tang , Davidlohr Bueso , Dan Williams , David Rientjes , Linux MM , Brice Goglin , Hesham Almatary Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 Wed, May 25, 2022 at 4:48 AM Jonathan Cameron wrote: > > On Wed, 25 May 2022 17:47:33 +1000 > Alistair Popple wrote: > > > Wei Xu writes: > > > > > On Tue, May 24, 2022 at 6:27 AM Aneesh Kumar K.V > > > wrote: > > >> > > >> Wei Xu writes: > > >> > > >> > On Wed, May 18, 2022 at 5:00 AM Jonathan Cameron > > >> > wrote: > > >> >> > > >> >> On Wed, 18 May 2022 00:09:48 -0700 > > >> >> Wei Xu wrote: > > >> > > >> ... > > >> > > >> > Nice :) > > >> >> > > >> >> Initially I thought this was over complicated when compared to just leaving space, but > > >> >> after a chat with Hesham just now you have us both convinced that this is an elegant solution. > > >> >> > > >> >> Few corners probably need fleshing out: > > >> >> * Use of an allocator for new tiers. Flat number at startup, or new one on write of unique > > >> >> value to set_memtier perhaps? Also whether to allow drivers to allocate (I think > > >> >> we should). > > >> >> * Multiple tiers with same rank. My assumption is from demotion path point of view you > > >> >> fuse them (treat them as if they were a single tier), but keep them expressed > > >> >> separately in the sysfs interface so that the rank can be changed independently. > > >> >> * Some guidance on what values make sense for given rank default that might be set by > > >> >> a driver. If we have multiple GPU vendors, and someone mixes them in a system we > > >> >> probably don't want the default values they use to result in demotion between them. > > >> >> This might well be a guidance DOC or appropriate set of #define > > >> > > > >> > All of these are good ideas, though I am afraid that these can make > > >> > tier management too complex for what it's worth. > > >> > > > >> > How about an alternative tier numbering scheme that uses major.minor > > >> > device IDs? For simplicity, we can just start with 3 major tiers. > > >> > New tiers can be inserted in-between using minor tier IDs. > > >> > > >> > > >> What drives the creation of a new memory tier here? Jonathan was > > >> suggesting we could do something similar to writing to set_memtier for > > >> creating a new memory tier. > > >> > > >> $ echo "memtier128" > sys/devices/system/node/node1/set_memtier > > >> > > >> But I am wondering whether we should implement that now. If we keep > > >> "rank" concept and detach tier index (memtier0 is the memory tier with > > >> index 0) separate from rank, I assume we have enough flexibility for a > > >> future extension that will allow us to create a memory tier from userspace > > >> and assigning it a rank value that helps the device to be placed before or > > >> after DRAM in demotion order. > > >> > > >> ie, For now we will only have memtier0, memtier1, memtier2. We won't add > > >> dynamic creation of memory tiers and the above memory tiers will have > > >> rank value 0, 1, 2 according with demotion order 0 -> 1 -> 2. > > > > > > Great. So the consensus is to go with the "rank" approach. The above > > > sounds good to me as a starting point. > > > > The rank approach seems good to me too. > > Rank is good, but I do slightly worry about accidentally defining ABI > that people care about with the particular numbers used for the initial ranks. > > Maybe just x100 on all of them to allow things in between with no change to > this initial set of 3? So 0, 100, 200 I strongly support this, which is also my original intention for rank values. I'd suggest to even remove 0 to avoid it becoming a special value that userspace depends on. > Jonathan > > > > > - Alistair > > > > >> -aneesh >