@@ -271,6 +271,7 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,
{
const char *devname = daxctl_dev_get_devname(dev);
struct json_object *jdev, *jobj;
+ int node;
jdev = json_object_new_object();
if (!devname || !jdev)
@@ -284,6 +285,13 @@ struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,
if (jobj)
json_object_object_add(jdev, "size", jobj);
+ node = daxctl_dev_get_target_node(dev);
+ if (node >= 0) {
+ jobj = json_object_new_int(node);
+ if (jobj)
+ json_object_object_add(jdev, "target_node", jobj);
+ }
+
return jdev;
}
The kernel provides a 'target_node' attribute for dax devices. When converting a dax device to the system-ram mode, the memory is hotplugged into this numa node. It would be helpful to print this in device listings so that it is easy for applications to detect the node to which the new memory belongs. Cc: Dan Williams <dan.j.williams@intel.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> --- util/json.c | 8 ++++++++ 1 file changed, 8 insertions(+)