On Tue, May 28, 2019 at 3:24 PM Vishal Verma <[email protected]> wrote:
>
> 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 numa node to
> which the new memory belongs.
>
> Cc: Dan Williams <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Signed-off-by: Vishal Verma <[email protected]>
> ---
>  util/json.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/util/json.c b/util/json.c
> index babdc8c..b7ce719 100644
> --- a/util/json.c
> +++ b/util/json.c
> @@ -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, "numa_node", jobj);

I think this should be named 'target_node' to not be confused with the
typical 'numa_node' attribute of a device that indicates closest cpu
node. This also collides with the 'numa_node' attribute that is
already emitted at the namespace level.

  {
    "dev":"namespace1.0",
    "mode":"devdax",
    "map":"dev",
    "size":134232408064,
    "uuid":"e6613922-80e9-49f9-ace8-961def867d32",
    "raw_uuid":"b79ce059-e33d-4a90-90ec-06d6786b3644",
    "daxregion":{
      "id":1,
      "size":134232408064,
      "align":2097152,
      "devices":[
        {
          "chardev":"dax1.0",
          "size":134232408064
        }
      ]
    },
    "align":2097152,
    "numa_node":0
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to