linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: linux-mm@kvack.org, Wei Xu <weixugc@google.com>,
	Huang Ying <ying.huang@intel.com>, Yang Shi <shy828301@gmail.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Tim C Chen <tim.c.chen@intel.com>,
	Michal Hocko <mhocko@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Hesham Almatary <hesham.almatary@huawei.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Alistair Popple <apopple@nvidia.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	jvgediya.oss@gmail.com, Bharata B Rao <bharata@amd.com>
Subject: Re: [PATCH v2] mm/demotion: Expose memory tier details via sysfs
Date: Mon, 29 Aug 2022 14:00:30 -0700	[thread overview]
Message-ID: <20220829140030.692cfd4dfbf7f9a8b282c951@linux-foundation.org> (raw)
In-Reply-To: <20220829060745.287468-1-aneesh.kumar@linux.ibm.com>

On Mon, 29 Aug 2022 11:37:45 +0530 "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> wrote:

> This patch adds /sys/devices/virtual/memory_tiering/ where all memory tier
> related details can be found. All allocated memory tiers will be listed
> there as /sys/devices/virtual/memory_tiering/memory_tierN/
> 
> The nodes which are part of a specific memory tier can be listed via
> /sys/devices/virtual/memory_tiering/memory_tierN/nodes
> 
> The abstract distance range value of a specific memory tier can be listed via
> /sys/devices/virtual/memory_tiering/memory_tierN/abstract_distance
> 
> A directory hierarchy looks like
> :/sys/devices/virtual/memory_tiering$ tree memory_tier4/
> memory_tier4/
> ├── abstract_distance
> ├── nodes
> ├── subsystem -> ../../../../bus/memory_tiering
> └── uevent
> 
> All toptier nodes are listed via
> /sys/devices/virtual/memory_tiering/toptier_nodes
> 
> :/sys/devices/virtual/memory_tiering$ cat toptier_nodes
> 0,2
> :/sys/devices/virtual/memory_tiering$ cat memory_tier4/nodes
> 0,2
> :/sys/devices/virtual/memory_tiering$ cat memory_tier4/abstract_distance
> 512 - 639
> 
> ...
>
> --- a/mm/memory-tiers.c
> +++ b/mm/memory-tiers.c
> @@ -19,6 +19,7 @@ struct memory_tier {
>  	 * adistance_start .. adistance_start + MEMTIER_CHUNK_SIZE
>  	 */
>  	int adistance_start;
> +	struct device dev;
>  	/* All the nodes that are part of all the lower memory tiers. */
>  	nodemask_t lower_tier_mask;
>  };
> @@ -36,6 +37,13 @@ static DEFINE_MUTEX(memory_tier_lock);
>  static LIST_HEAD(memory_tiers);
>  static struct node_memory_type_map node_memory_types[MAX_NUMNODES];
>  static struct memory_dev_type *default_dram_type;
> +
> +#define to_memory_tier(device) container_of(device, struct memory_tier, dev)

Please, only use a macro when a C function cannot be used.

--- a/mm/memory-tiers.c~mm-demotion-expose-memory-tier-details-via-sysfs-fix
+++ a/mm/memory-tiers.c
@@ -38,7 +38,11 @@ static LIST_HEAD(memory_tiers);
 static struct node_memory_type_map node_memory_types[MAX_NUMNODES];
 static struct memory_dev_type *default_dram_type;
 
-#define to_memory_tier(device) container_of(device, struct memory_tier, dev)
+static inline struct memory_tier *to_memory_tier(struct device *device)
+{
+	return container_of(device, struct memory_tier, dev);
+}
+
 static struct bus_type memory_tier_subsys = {
 	.name = "memory_tiering",
 	.dev_name = "memory_tier",

If only so it checks the type of `device'.


  reply	other threads:[~2022-08-29 21:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29  6:07 Aneesh Kumar K.V
2022-08-29 21:00 ` Andrew Morton [this message]
2022-08-30  6:31 ` Wei Xu
2022-08-30  6:46   ` Aneesh Kumar K V
2022-08-30  7:17     ` Wei Xu
2022-08-30  7:28       ` Aneesh Kumar K V
2022-09-01  6:37       ` Huang, Ying

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220829140030.692cfd4dfbf7f9a8b282c951@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=apopple@nvidia.com \
    --cc=bharata@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave@stgolabs.net \
    --cc=hannes@cmpxchg.org \
    --cc=hesham.almatary@huawei.com \
    --cc=jvgediya.oss@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=shy828301@gmail.com \
    --cc=tim.c.chen@intel.com \
    --cc=weixugc@google.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox