Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7991020imu; Thu, 15 Nov 2018 05:01:05 -0800 (PST) X-Google-Smtp-Source: AJdET5ftyQgPpP5oARqdsb7gXJLWcht4EMbMJkfV9j6dTrw6b10eaRKqXEzz+3dvIepdku8KeicN X-Received: by 2002:a65:448a:: with SMTP id l10mr5712243pgq.387.1542286865571; Thu, 15 Nov 2018 05:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542286865; cv=none; d=google.com; s=arc-20160816; b=QwOGjNejv1V0JA/8nDdYT+vV5JSRQvOLlGYuD/GHTszUCvp+6gieflvh+6ZP9LgtJM XxzfKCLlrehamEZsPzM92Y1MQsfNeZPZHFrOKRRV82ZacDndqSNGBIH0Hs7VvCw95Fuu k24yu3tqw83HRnQOwea24DxwRomgORtcSHrIk+gsi2HXTnSJK11gwIJFp9t5quot4iSc PqpD0QYGqGW2yYWVtnJtEGX60nEKAcHed9qW8SvJZBdjGxOXq0iAWlTJj2yOgAGdy92F MyPsMlLm8RgRJ5iVYqqPJXhBWVVVsEQrmv6fRhSFVLB1BWHpeIW3OV4tdn65AYRag28b 4bYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=coHNl42rO6jupZzBr51WLDqAf7Gn+lPyjvNzwnwhgHQ=; b=HKDGXxqvZ/yiWm7fG5DqyW+DOFDT1yvxLQBuvsxB5cGLsiBS+H2LzkVl/g1F+MWTZS DddvWK9gs62I858TLQIjKPxreXJ2lcZWQFmHaJpaJXtPv9aWlNkHFi5D6DU3/WRe1Vxp KcqLfwFLfmS1RxpSB/rYCtQ4vD32zLnvrDk3JlSq9PswX51reTTPah4o0nw0VbJAS9CB 3O+qE9ymF8u+VmpJd5wcxlBZ7EKCB9OQA4laMSZCQxJ+V8T3jYmHFzx6TLuO+WxA7TkU TRsmJpvQO6IWiTaJ6+V2QLhEUKTq2kvaTyb4l9namXtkMBpteE4jxam444iLH0I1c48h 0pgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5-v6si25082022pgi.27.2018.11.15.05.00.48; Thu, 15 Nov 2018 05:01:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388327AbeKOXHO (ORCPT + 99 others); Thu, 15 Nov 2018 18:07:14 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:14674 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728757AbeKOXHN (ORCPT ); Thu, 15 Nov 2018 18:07:13 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 65FDCDECBF2EA; Thu, 15 Nov 2018 20:59:24 +0800 (CST) Received: from localhost (10.202.226.46) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.408.0; Thu, 15 Nov 2018 20:59:20 +0800 Date: Thu, 15 Nov 2018 12:59:09 +0000 From: Jonathan Cameron To: Keith Busch CC: , , , Greg Kroah-Hartman , "Rafael Wysocki" , Dave Hansen , "Dan Williams" Subject: Re: [PATCH 3/7] doc/vm: New documentation for memory performance Message-ID: <20181115125909.000067aa@huawei.com> In-Reply-To: <20181114224921.12123-4-keith.busch@intel.com> References: <20181114224921.12123-2-keith.busch@intel.com> <20181114224921.12123-4-keith.busch@intel.com> Organization: Huawei X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.46] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Nov 2018 15:49:16 -0700 Keith Busch wrote: > Platforms may provide system memory where some physical address ranges > perform differently than others. These heterogeneous memory attributes are > common to the node that provides the memory and exported by the kernel. > > Add new documentation providing a brief overview of such systems and > the attributes the kernel makes available to aid applications wishing > to query this information. > > Signed-off-by: Keith Busch Hi Keith, Good to see another attempt at this, particularly thinking about simplifying what is provided to make it easier to use. I need to have a bit of a think about how this maps onto more complex topologies, but some initial comments / questions in the meantime. > --- > Documentation/vm/numaperf.rst | 71 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 71 insertions(+) > create mode 100644 Documentation/vm/numaperf.rst > > diff --git a/Documentation/vm/numaperf.rst b/Documentation/vm/numaperf.rst > new file mode 100644 > index 000000000000..5a3ecaff5474 > --- /dev/null > +++ b/Documentation/vm/numaperf.rst > @@ -0,0 +1,71 @@ > +.. _numaperf: > + > +================ > +NUMA Performance > +================ > + > +Some platforms may have multiple types of memory attached to a single > +CPU. These disparate memory ranges share some characteristics, such as > +CPU cache coherence, but may have different performance. For example, > +different media types and buses affect bandwidth and latency. > + > +A system supporting such heterogeneous memory groups each memory type > +under different "nodes" based on similar CPU locality and performance > +characteristics. I think this statement should be more specific. The requirement is that it should have similar CPU locality and performance characteristics wrt to every initiator in the system, not just the local one. > Some memory may share the same node as a CPU, and > +others are provided as memory-only nodes. While memory only nodes do not > +provide CPUs, they may still be local to one or more compute nodes. The > +following diagram shows one such example of two compute noes with local > +memory and a memory only node for each of compute node: > + > + +------------------+ +------------------+ > + | Compute Node 0 +-----+ Compute Node 1 | > + | Local Node0 Mem | | Local Node1 Mem | > + +--------+---------+ +--------+---------+ > + | | > + +--------+---------+ +--------+---------+ > + | Slower Node2 Mem | | Slower Node3 Mem | > + +------------------+ +--------+---------+ > + > +A "memory initiator" is a node containing one or more devices such as > +CPUs or separate memory I/O devices that can initiate memory requests. A > +"memory target" is a node containing one or more CPU-accessible physical > +address ranges. > + > +When multiple memory initiators exist, accessing the same memory > +target may not perform the same as each other. When multiple initiators exist, they may not all show the same performance when accessing a given memory target. > The highest performing > +initiator to a given target is considered to be one of that target's > +local initiators. One of, or the only? Are we allowing a many to one mapping if several initiators have the same performance but are in different nodes? Also, what is your measure of performance, latency or bandwidth or some combination of the two? > + > +To aid applications matching memory targets with their initiators, > +the kernel provide symlinks to each other like the following example:: > + > + # ls -l /sys/devices/system/node/nodeX/initiator* > + /sys/devices/system/node/nodeX/targetY -> ../nodeY ls on initiator* is giving targetY? > + > + # ls -l /sys/devices/system/node/nodeY/target* > + /sys/devices/system/node/nodeY/initiatorX -> ../nodeX > + Just to check as I'm not clear, do we have self links when the memory and initiators are in the same node? > +Applications may wish to consider which node they want their memory to > +be allocated from based on the nodes performance characteristics. If > +the system provides these attributes, the kernel exports them under the > +node sysfs hierarchy by appending the initiator_access directory under > +the node as follows:: > + > + /sys/devices/system/node/nodeY/initiator_access/ > + > +The kernel does not provide performance attributes for non-local memory > +initiators. The performance characteristics the kernel provides for > +the local initiators are exported are as follows:: > + > + # tree /sys/devices/system/node/nodeY/initiator_access > + /sys/devices/system/node/nodeY/initiator_access > + |-- read_bandwidth > + |-- read_latency > + |-- write_bandwidth > + `-- write_latency > + > +The bandwidth attributes are provided in MiB/second. > + > +The latency attributes are provided in nanoseconds. > + > +See also: https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf My worry here is we are explicitly making an interface that is only ever providing "local" node information, where local node is not the best defined thing in the world for complex topologies. I have no problem with that making a sensible starting point for providing information userspace knows what to do with, just with an interface that in of itself doesn't make that clear. Perhaps something as simple as /sys/devices/system/nodeY/local_initiatorX /sys/devices/system/nodeX/local_targetY That leaves us the option of coming along later and having a full listing when a userspace requirement has become clear. Another option would be an exhaustive list of all initiator / memory pairs that exist, with an additional sysfs file giving a list of those that are nearest to avoid every userspace program having to do the search. Thanks, Jonathan