Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1052421iob; Fri, 13 May 2022 21:12:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvkG68xNGV4Ntkns0PTJXwsBo6wtBPiPtiRpJexkfRGf4zIpR72+3GaKpQEEDdi+KDeIvy X-Received: by 2002:a7b:c842:0:b0:394:8d6c:2768 with SMTP id c2-20020a7bc842000000b003948d6c2768mr7204603wml.205.1652501565769; Fri, 13 May 2022 21:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652501565; cv=none; d=google.com; s=arc-20160816; b=zpt50LlYJspKgEuTMuoVO1zp0Y3AI5aBzniLLzf1FZ98+N+B88Y/2tMBFncadd67Xq wAs1994CVZivxVTkXBIAtmYvaOhWckmDatVzQToPJRP690iOdIZ0loCL1OXKdh0kiGoC nhNJqHrsMSMjGwiSrSJ9lbp6QXsFQTfnrsXuTmJZyK168j+QJfWnBBtuKVAxtbLGZA01 BFzPmxFpjOMJvyh48QrOT3FX2pak+5gsjDtUlpVHzy/rJbIID9ySgKKUA3nnD6/IbpXR lSex5X15pbEK1ZINxLqwttKh9POl/dqr3udZOY8ZZ4kcbGqlSBK35uuJT9u7wbux9R2P tOwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id :dkim-signature; bh=QyeA8d6kg8CaIjyJb/NZI15oR56kJje5TArC4G5c2RU=; b=xSuCYb9n6dzLVBICDY1M+nfWRi4gu2HNgYgD+ddHH0BbNcLW8COjyqfDB2vDfsdCT/ s/PjkLSvIIoWYs5c8ZFrU7mWybQTei0r4ExLxO7F9/HmtwjCDjLwxBUSc3rkRe0M+67q Hz5WT1dVBE5UCG70HNsqq1Uh4HlFVzoKK3DgFLP4oFvHbKo6MDZVGcAgXzsnfPY8XV/m OnD+ndOPA4UBqlbVXnfakYFkilsAOqFBFgWz2Cy13L0HV2xcUlrUDQ/VkDCNajFmLQdh OzfJPWUHdfJbxbHTcpUBIWGREopyOxXZMaD+YFZLQeh1OlhrcPkffWuGssw2hPuhDbMC tTQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Sa0gBgNH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i67-20020a1c3b46000000b003942fb526a6si3762633wma.93.2022.05.13.21.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Sa0gBgNH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 236DF317D32; Fri, 13 May 2022 17:44:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350868AbiELHTM (ORCPT + 99 others); Thu, 12 May 2022 03:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350877AbiELHTJ (ORCPT ); Thu, 12 May 2022 03:19:09 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA3EAC5DBA for ; Thu, 12 May 2022 00:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652339947; x=1683875947; h=message-id:subject:from:to:date:in-reply-to:references: mime-version:content-transfer-encoding; bh=YgDjZJ0GrhB2TixzXN5MHJpkRl2ysRB6/EQ97IsEbNI=; b=Sa0gBgNHo6lqWDgovArpaOrwbz2vy84hKq+UtWMKzcTzq0NV+ZDW03PQ GmkqmcDL+QGfDqryUwm/T9JgK6CW9leFyyeyFEwPf+BygQtBVx+CpDltz CIaraG/L4Hyo0XEs38Q6O6HouwAIN26xU0oCQa/cU6/3h4iJ/I1Sdxr56 q6sJHDYyedvMmHzfXeJykrAQ3IpoyNJVWs/yykgedV5tPXg3P53TzLwQz Qy7FamKRX6erX1xWzOD4UO1QxVSsb7QmYB0iWqyNVtVPjLsTVKqVB1Rir ZcwQZ7QNC998BHaKRTJpFF1XJ5XK7ITvUru5L128ojYmHZUQCdh/d2Z+U A==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="268753313" X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="268753313" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 00:18:36 -0700 X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="566550286" Received: from ruonanwa-mobl.ccr.corp.intel.com ([10.254.212.157]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 00:18:30 -0700 Message-ID: <9c93f72ad70687d06e9318f8023ce45d39f742e3.camel@intel.com> Subject: Re: RFC: Memory Tiering Kernel Interfaces (v2) From: "ying.huang@intel.com" To: Aneesh Kumar K V , Wei Xu , 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 Date: Thu, 12 May 2022 15:18:27 +0800 In-Reply-To: References: <56b41ce6922ed5f640d9bd46a603fa27576532a9.camel@intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 Thu, 2022-05-12 at 12:42 +0530, 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 This will make the interface not extensible. Even a single file "/sys/devices/system/node/memtiers" is better. As an readonly file, it should be OK to put multiple values in it. I remember that one rule for sysfs is that it is accessed more via libsysfs. Does that make life easier? Best Regards, Huang, Ying