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 C7549C433FE for ; Fri, 22 Apr 2022 17:37:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E7FC6B0074; Fri, 22 Apr 2022 13:37:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 398A96B0075; Fri, 22 Apr 2022 13:37:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25F946B0078; Fri, 22 Apr 2022 13:37:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 1A4E16B0074 for ; Fri, 22 Apr 2022 13:37:17 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id F02E880A60 for ; Fri, 22 Apr 2022 17:37:16 +0000 (UTC) X-FDA: 79385221272.11.175DC35 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf29.hostedemail.com (Postfix) with ESMTP id E41BA120030 for ; Fri, 22 Apr 2022 17:37:14 +0000 (UTC) Received: by mail-pf1-f169.google.com with SMTP id b15so8642649pfm.5 for ; Fri, 22 Apr 2022 10:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=OZTgMPH9Pxi3nCqnIacIQrfeG7gnS/pKi1r4Mc7HcDs=; b=fjjvrmTdM9nn7GZ2f47W0XnahdAqPMYF645kNo0dHqor07t5HOJrx+xy4RBWf+He4x v1DVWg+2UoGFcgRunb+/wSx4FLdf3eD62Ao8J4t0mScnpTxiy3mjZWy0QD4pa5lHnNJs mL3otI21RYGUksjcY5+m2py0xBTzboASdb9sP80hXMWwWKAzJ8svXz11UIpNcDqqzsbQ ZNmGc3oQe7SLc5N2y2WQVMuOoOhJ5gZip36Ppcb24hPXNSOv8SeA0wNmKMa6g+hFk/pK V+xUWh6Nj6ZWRCSwJnwAMpTR1W/tV2uqiEXgm5jjZkoGH4fGwDSb0gY6IFvuDVgGfh+6 daxA== 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; bh=OZTgMPH9Pxi3nCqnIacIQrfeG7gnS/pKi1r4Mc7HcDs=; b=NLYrHhwkKYehXnrw6sWsw6Ya62HnxgKY0mNeOvxevL/pu30Ok1CwJI1zw8SK2DZe5i i6O6SoTOrHpd4EI/B3yh9RNnvDVJt6dAtbbsRdkUbVhLNh3Vg/zyTZU/Uw/kxxSQfbAD Ww3lpa3pxYCY9BH89Kc6ajrQW8qxs/2Y+RPUeNrpEjjCMcO0kMkGcSu6wF2nTJTlNbgD stecPqzy9giDMyVcfTU6/k8QDa5hg2vAgmYMSe2HaDfB5923s/hN7OVFlpfXi4oOeUDx PTidwUG7nv/M6FEeLDt72OYebPr4bDBsUU3a8CITBaZd15cGa1k5XfkT1vAAv49YlcdL EYYA== X-Gm-Message-State: AOAM533A02WfV9arVeDouDtvqmvPe+wW71Y27GIm51SmEITu0u7wJ9Bw 3UaKtMjpUKurSfykLM2CCN+7Alt3Mt099ryjBGBTpZ0zcpQ= X-Google-Smtp-Source: ABdhPJwcty+geLkVBerxwWZAwgWuRj+bwlAp3XZHyWx/9WdIbvLqVAmvr1abK4wNU/x8a40h2nNdKPB43lTYeGeJhow= X-Received: by 2002:a62:e518:0:b0:4fa:9333:ddbd with SMTP id n24-20020a62e518000000b004fa9333ddbdmr6140985pff.11.1650649034742; Fri, 22 Apr 2022 10:37:14 -0700 (PDT) MIME-Version: 1.0 References: <20220416053902.68517-1-dave@stgolabs.net> <20220417034932.jborenmvfbqrfhlj@offworld> In-Reply-To: <20220417034932.jborenmvfbqrfhlj@offworld> From: Yang Shi Date: Fri, 22 Apr 2022 10:37:00 -0700 Message-ID: Subject: Re: [PATCH 6/6] mm/migrate: export whether or not node is toptier in sysf To: linux-mm@kvack.org, mhocko@kernel.org, akpm@linux-foundation.org, rientjes@google.com, yosryahmed@google.com, hannes@cmpxchg.org, shakeelb@google.com, dave.hansen@linux.intel.com, tim.c.chen@linux.intel.com, roman.gushchin@linux.dev, gthelen@google.com, a.manzanares@samsung.com, heekwon.p@samsung.com, gim.jongmin@samsung.com, linux-kernel@vger.kernel.org, jvgediya@linux.ibm.com, ying.huang@intel.com Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: du69wia6rtxr6y7oqmonpzpxk94yi9oy Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fjjvrmTd; spf=pass (imf29.hostedemail.com: domain of shy828301@gmail.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E41BA120030 X-HE-Tag: 1650649034-164118 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: On Sat, Apr 16, 2022 at 8:49 PM Davidlohr Bueso wrote: > > > > This allows userspace to know if the node is considered fast > memory (with CPUs attached to it). While this can be already > derived without a new file, this helps further encapsulate the > concept. > > Signed-off-by: Davidlohr Bueso > --- > Resending, just noticed this oatch was never posted. > > Documentation/ABI/stable/sysfs-devices-node | 6 ++++++ > drivers/base/node.c | 13 +++++++++++++ > 2 files changed, 19 insertions(+) > > diff --git a/Documentation/ABI/stable/sysfs-devices-node b/Documentation/ABI/stable/sysfs-devices-node > index f620c6ae013c..1c21c3985535 100644 > --- a/Documentation/ABI/stable/sysfs-devices-node > +++ b/Documentation/ABI/stable/sysfs-devices-node > @@ -198,3 +198,9 @@ Date: April 2022 > Contact: Davidlohr Bueso > Description: > Shows nodes within the next tier of slower memory below this node. > + > +What: /sys/devices/system/node/nodeX/memory_toptier > +Date: April 2022 > +Contact: Davidlohr Bueso > +Description: > + Node is attached to fast memory or not. > diff --git a/drivers/base/node.c b/drivers/base/node.c > index ab4bae777535..b9de5b0360f2 100644 > --- a/drivers/base/node.c > +++ b/drivers/base/node.c > @@ -598,12 +598,25 @@ static ssize_t node_read_demotion_path(struct device *dev, > } > static DEVICE_ATTR(demotion_path, 0444, node_read_demotion_path, NULL); > > +static ssize_t node_read_memory_toptier(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + int nid = dev->id; > + int len = 0; > + > + len += sysfs_emit_at(buf, len, "%d\n", !!node_is_toptier(nid)); It is not guaranteed. Some hardware configurations have cpuless DRAM nodes, but they should be treated as top tier nodes IMHO. Please see https://lore.kernel.org/linux-mm/20220413092206.73974-1-jvgediya@linux.ibm.com/ > + > + return len; > +} > +static DEVICE_ATTR(memory_toptier, 0444, node_read_memory_toptier, NULL); > + > static struct attribute *node_dev_attrs[] = { > &dev_attr_meminfo.attr, > &dev_attr_numastat.attr, > &dev_attr_distance.attr, > &dev_attr_vmstat.attr, > &dev_attr_demotion_path.attr, > + &dev_attr_memory_toptier.attr, > NULL > }; > > -- > 2.26.2 >