lkml.org 
[lkml]   [2022]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] dax/kmem: Update spanned page stat of origin device node
Date
When device memory adds to the online NUMA node, the number of spanned
pages of the original device NUMA node should be updated.

By this patch, we can monitor the current spanned pages of each node
more accurately.

Signed-off-by: Jonghyeon Kim <tome01@ajou.ac.kr>
---
drivers/dax/kmem.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index a37622060fff..f63a739ac790 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -11,6 +11,7 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/mman.h>
+#include <linux/memory_hotplug.h>
#include "dax-private.h"
#include "bus.h"

@@ -48,6 +49,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)
struct dax_kmem_data *data;
int i, rc, mapped = 0;
int numa_node;
+ int dev_node;

/*
* Ensure good NUMA information for the persistent memory.
@@ -147,6 +149,18 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)

dev_set_drvdata(dev, data);

+ /* Update spanned_pages of the device numa node */
+ dev_node = dev_to_node(dev);
+ if (dev_node != numa_node && dev_node < numa_node) {
+ struct pglist_data *pgdat = NODE_DATA(dev_node);
+ struct zone *zone = &pgdat->node_zones[ZONE_DEVICE];
+ unsigned long start_pfn = zone->zone_start_pfn;
+ unsigned long nr_pages = NODE_DATA(numa_node)->node_spanned_pages;
+
+ shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
+ update_pgdat_span(pgdat);
+ }
+
return 0;

err_request_mem:
--
2.17.1
\
 
 \ /
  Last update: 2022-01-26 18:01    [W:0.110 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site