Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp989968iob; Fri, 13 May 2022 18:47:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDNW6VRLHpOHr29VzNdhHttXPbo68lh7QDhIsC5t2TjxST9/QZYZeubt9Unwcql0AZrE+7 X-Received: by 2002:a7b:cd98:0:b0:394:2431:2393 with SMTP id y24-20020a7bcd98000000b0039424312393mr6949117wmj.122.1652492877654; Fri, 13 May 2022 18:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652492877; cv=none; d=google.com; s=arc-20160816; b=SoSGZd7A9Llz0XGcSkx7NXszSGgcLoBk+bUfgSBnhDmpKmC0vzo1hduwUQqx14p1yQ fhX1RyosnCM11K24DKotFBFXluVqeQVtHt6ZhX82XW+z4Layjf3sM6Jprsa60S/ZUFYP 2V/DbNUm3+JMDTvk1tGcZU+TS/BsWAZXsitp3WZLvsExyD01Wey1T5oPiPbhaUMxTS5a Sl2o6fg+bFzuycftEaxF+3bU+ZHjZrfoLVH+cT50yMCdNPg0gQ/1feATposr2vYiaMNJ lGA8/JxB+mswvlKS85BaoyDp6xNqXMzZwfNYJCgu6wB4TPCyVlwdEtWzoasnRor9kfGR zBBw== 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=+47ZJ5j0kmxI/lG0OiobIxpstGwfhpvNpvMEZldSxdk=; b=CokTKOGQ2mUx/FwDfbuqewpnfR0sdGKAZboMDmwJimGtj/7C50w6+2/Mo6jPdRQEmz BlgmJ5VNOn2YVSyg9QkD7zFB5L4ZuQMVREOxLhlaBFN0OdlIn/SNjsPl5PD/+FSqKvcV a9I82XIL3Ha1vZcnx8NEg8/mbuJ58VDqmNKhtw5Cp0+/ryS2QCw2tCXSbiRFQhZQ8YRU r//wRINi1V3PAK/PNfOK6+ILBerY9KvfrFeUs9poaaH96Wopwdj44R9QxZxHtqr3F9yk mOvAVg6TQLmgExDuuNuWOvMjxcXlLxTItKTFLhFDbHfHltq2lyGuhQ2Pxsj/aDNj1ud+ AQBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=MuT9tsxo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a17-20020adfbc51000000b00207ae4bbacesi3766107wrh.433.2022.05.13.18.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:47:57 -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=@google.com header.s=20210112 header.b=MuT9tsxo; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C7B602E4B72; Fri, 13 May 2022 17:12:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242114AbiELHXJ (ORCPT + 99 others); Thu, 12 May 2022 03:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350927AbiELHWs (ORCPT ); Thu, 12 May 2022 03:22:48 -0400 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E0012C662 for ; Thu, 12 May 2022 00:22:45 -0700 (PDT) Received: by mail-vs1-xe2b.google.com with SMTP id y74so4284143vsy.7 for ; Thu, 12 May 2022 00:22: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=+47ZJ5j0kmxI/lG0OiobIxpstGwfhpvNpvMEZldSxdk=; b=MuT9tsxoUEIIaxiykQc0WLAgcqyuwhOycLY1xIEQd7ISyb9br2bf1LLu+S4UYj8lj3 8m8ze6NTZqKhc0v5SyIPcQuA1R4qBoZA8Q6lAtk8HXB52Dd5KPqt+Ds+6dH7RyNc3TYi 4AgMOAq57JN+k1UxDq7cpOQpSH1gnBZ0NE0rApDav0VPZa8lkVnuA+LUVltiiB7L5/LT g+vwuxnOgeYHHjNqvZPl+cxcTVHhC6k5l3263yTd4OfbT2B8/zHLPCZKdpEIT8k65Rzx nC4cty7D55MnVNslHa/C0HTGsyrzh8pMo1+YsLZSQVkxb3aQMO1mdX3GOhlYcRB2+GJC 6Osw== 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=+47ZJ5j0kmxI/lG0OiobIxpstGwfhpvNpvMEZldSxdk=; b=xDxCkgYxdMjkxFR89tUwYS2kUM0BJWYMPxY5CL/FKgXAr5J6v5qO/X5qDuBhEbB/B+ BcngjraXFumFPE8AV20z0Di2cGESliNdkdf8TfdLtaA180NnSotASzNgULIpTqUtXAXg ve8L7cIJYSrhFlascy+8ItygxeBqJ7232lPEk5N7eByFk3z7/tBkrvG5bqm1YZBUCHq7 r/PPzib8GcW4xAvniMCQevc+7q0ksCFupnvuTuZzixRTWrkeOqKcY3yUSlqxdSY7CwdM w50ERFrrPX+wlp74ED4Btwur5eEGn9l5mlfmWsaxEjN07w0auC4bTHdfLxq7bRZBZRq1 WlEA== X-Gm-Message-State: AOAM5326BPIWzC08SEMyh+uPPljSTKYIqTpkJGNi9Vk/wgQLsLkFiNop XdhoIIUjSQ+KXqdhQ5A3Kw44eQuWzTBHui6NA6c4xA== X-Received: by 2002:a67:2fc6:0:b0:32d:7195:32e9 with SMTP id v189-20020a672fc6000000b0032d719532e9mr15747916vsv.44.1652340164357; Thu, 12 May 2022 00:22:44 -0700 (PDT) MIME-Version: 1.0 References: <56b41ce6922ed5f640d9bd46a603fa27576532a9.camel@intel.com> In-Reply-To: From: Wei Xu Date: Thu, 12 May 2022 00:22:33 -0700 Message-ID: Subject: Re: RFC: Memory Tiering Kernel Interfaces (v2) To: Aneesh Kumar K V Cc: "ying.huang@intel.com" , Andrew Morton , Greg Thelen , Yang Shi , Linux Kernel Mailing List , Jagdish Gediya , Michal Hocko , Tim C Chen , Dave Hansen , Alistair Popple , Baolin Wang , Feng Tang , Jonathan Cameron , Davidlohr Bueso , Dan Williams , David Rientjes , Linux MM , Brice Goglin , Hesham Almatary Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Thu, May 12, 2022 at 12:12 AM Aneesh Kumar K V wrote: > > On 5/12/22 12:33 PM, ying.huang@intel.com wrote: > > On Wed, 2022-05-11 at 23:22 -0700, Wei Xu wrote: > >> Sysfs Interfaces > >> ================ > >> > >> * /sys/devices/system/memtier/memtierN/nodelist > >> > >> where N = 0, 1, 2 (the kernel supports only 3 tiers for now). > >> > >> Format: node_list > >> > >> Read-only. When read, list the memory nodes in the specified tier. > >> > >> Tier 0 is the highest tier, while tier 2 is the lowest tier. > >> > >> The absolute value of a tier id number has no specific meaning. > >> What matters is the relative order of the tier id numbers. > >> > >> When a memory tier has no nodes, the kernel can hide its memtier > >> sysfs files. > >> > >> * /sys/devices/system/node/nodeN/memtier > >> > >> where N = 0, 1, ... > >> > >> Format: int or empty > >> > >> When read, list the memory tier that the node belongs to. Its value > >> is empty for a CPU-only NUMA node. > >> > >> When written, the kernel moves the node into the specified memory > >> tier if the move is allowed. The tier assignment of all other nodes > >> are not affected. > >> > >> Initially, we can make this interface read-only. > > > > It seems that "/sys/devices/system/node/nodeN/memtier" has all > > information we needed. Do we really need > > "/sys/devices/system/memtier/memtierN/nodelist"? > > > > That can be gotten via a simple shell command line, > > > > $ grep . /sys/devices/system/node/nodeN/memtier | sort -n -k 2 -t ':' > > > > It will be really useful to fetch the memory tier node list in an easy > fashion rather than reading multiple sysfs directories. If we don't have > other attributes for memorytier, we could keep > "/sys/devices/system/memtier/memtierN" a NUMA node list there by > avoiding /sys/devices/system/memtier/memtierN/nodelist > > -aneesh It is harder to implement memtierN as just a file and doesn't follow the existing sysfs pattern, either. Besides, it is extensible to have memtierN as a directory.