Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7287026imu; Wed, 14 Nov 2018 14:55:48 -0800 (PST) X-Google-Smtp-Source: AJdET5c0maNWMLcEMD5HckS6QW7KeYTDdMB8PHF+P1fwpbmQV0V7eHZeYRcYZCb4eFWYOSPBDRWn X-Received: by 2002:a17:902:9a47:: with SMTP id x7-v6mr3786029plv.316.1542236148542; Wed, 14 Nov 2018 14:55:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542236148; cv=none; d=google.com; s=arc-20160816; b=0nvCilDgVXELEnU+3GM+QZLjDt7qcuxq2KTtr/NwyLNY3IOXcKCBhEim/L+zaRR/lg gDiB5B0MrJ3jXDJMyq4fuJzA+yaL1F3ZDo+2I+7LFUyNFijXLUlte3MHYuVMTNZ9W7Xg 8Z+kJ7nquobyijLIagEqxvPjbCEzm5DaXTYpYB/gTl4iSxRtFRkCJFxgf2WA4Ef1M2i/ DEJOzBDxXoJBukp1dIN6/x2fI2b7JtQjLYZ61wGlGIhTzMH+FrKrBL3YuUicGRTJbXFY NV1c5Qr0xLtmL2hXSH77+wObR3cUYFofRCjbD4FgOczQDoxQ7N5J+7+MNAjm0LudZTRe f8iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=+ITiI+DOKQv2M/zI2RuqPItw78++KPuAgzud/7mnErc=; b=ND+7wpDkYJiKZ7eOd3mcE/WhJ410RRtdYamp0onCoJd0cbyjI5bvsmnTjz3g1TPkcK Zk6XC3O5EvU42eMcVdVycUWIqh8UNcddljqpqEmX6/1D3CRK3d0M9OH16rGoNNvnzvlr Wkzz4Jp6FYXiRAK3sVZxVfxxbCz/p3a0L8P1OD6/RAEOsqOJi2m6Z3p6/LET5aXv99oE 7A9aYim2nbOy/5Om08FMWVpLkbeC1ClTg8/heMek7L9uU/GdCbErZ8hIaqGA18x1LpiR ejpJ9tXlyTUrfefrPjEhc/vRWfLfytLrXXfje9KQ/9JzOKl8PbhXLf94MCgQXz5GWuG1 UP6A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d82-v6si27775443pfe.190.2018.11.14.14.55.34; Wed, 14 Nov 2018 14:55:48 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728658AbeKOI6n (ORCPT + 99 others); Thu, 15 Nov 2018 03:58:43 -0500 Received: from mga12.intel.com ([192.55.52.136]:50985 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbeKOI6T (ORCPT ); Thu, 15 Nov 2018 03:58:19 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2018 14:53:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,234,1539673200"; d="scan'208";a="106314891" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.69]) by fmsmga004.fm.intel.com with ESMTP; 14 Nov 2018 14:53:04 -0800 From: Keith Busch To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org Cc: Greg Kroah-Hartman , Rafael Wysocki , Dave Hansen , Dan Williams , Keith Busch Subject: [PATCH 5/7] doc/vm: New documentation for memory cache Date: Wed, 14 Nov 2018 15:49:18 -0700 Message-Id: <20181114224921.12123-6-keith.busch@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20181114224921.12123-2-keith.busch@intel.com> References: <20181114224921.12123-2-keith.busch@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Platforms may provide system memory that contains side caches to help spped up access. These memory caches are part of a memory node and the cache attributes are exported by the kernel. Add new documentation providing a brief overview of system memory side caches and the kernel provided attributes for application optimization. Signed-off-by: Keith Busch --- Documentation/vm/numacache.rst | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Documentation/vm/numacache.rst diff --git a/Documentation/vm/numacache.rst b/Documentation/vm/numacache.rst new file mode 100644 index 000000000000..e79c801b7e3b --- /dev/null +++ b/Documentation/vm/numacache.rst @@ -0,0 +1,76 @@ +.. _numacache: + +========== +NUMA Cache +========== + +System memory may be constructed in a hierarchy of various performing +characteristics in order to provide large address space of slower +performing memory cached by a smaller size of higher performing +memory. The system physical addresses that software is aware of see +is provided by the last memory level in the hierarchy, while higher +performing memory transparently provides caching to slower levels. + +The term "far memory" is used to denote the last level memory in the +hierarchy. Each increasing cache level provides higher performing CPU +access, and the term "near memory" represents the highest level cache +provided by the system. This number is different than CPU caches where +the cache level (ex: L1, L2, L3) uses a CPU centric view with each level +being lower performing and closer to system memory. The memory cache +level is centric to the last level memory, so the higher numbered cache +level denotes memory nearer to the CPU, and further from far memory. + +The memory side caches are not directly addressable by software. When +software accesses a system address, the system will return it from the +near memory cache if it is present. If it is not present, the system +accesses the next level of memory until there is either a hit in that +cache level, or it reaches far memory. + +In order to maximize the performance out of such a setup, software may +wish to query the memory cache attributes. If the system provides a way +to query this information, for example with ACPI HMAT (Heterogeneous +Memory Attribute Table)[1], the kernel will append these attributes to +the NUMA node that provides the memory. + +When the kernel first registers a memory cache with a node, the kernel +will create the following directory:: + + /sys/devices/system/node/nodeX/cache/ + +If that directory is not present, then either the memory does not have +a side cache, or that information is not provided to the kernel. + +The attributes for each level of cache is provided under its cache +level index:: + + /sys/devices/system/node/nodeX/cache/indexA/ + /sys/devices/system/node/nodeX/cache/indexB/ + /sys/devices/system/node/nodeX/cache/indexC/ + +Each cache level's directory provides its attributes. For example, +the following is a single cache level and the attributes available for +software to query:: + + # tree sys/devices/system/node/node0/cache/ + /sys/devices/system/node/node0/cache/ + |-- index1 + | |-- associativity + | |-- level + | |-- line_size + | |-- size + | `-- write_policy + +The cache "associativity" will be 0 if it is a direct-mapped cache, and +non-zero for any other indexed based, multi-way associativity. + +The "level" is the distance from the far memory, and matches the number +appended to its "index" directory. + +The "line_size" is the number of bytes accessed on a cache miss. + +The "size" is the number of bytes provided by this cache level. + +The "write_policy" will be 0 for write-back, and non-zero for +write-through caching. + +[1] https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf -- 2.14.4