3

I am working on a checkpoint/Restart Linux kernel module. Wherein, a process sends a request to this module to checkpoint itself. In this process information about the process is stored in a file, which is used later on to restart the process.

Now when this module is storing the information related to pages (of the process) in a file, we also want to know on which NUMA node this page was assigned Can you suggest what will be the best way to get this data (page to NUMA node mapping). As I am in the kernel space, I would like to use the linux kernel functions itself to get this information.

I tried using page_to_nid(page), but I am not really sure it gives me correct value. (Like, I am working on linux 2.6.32, 64 bit machine with 16 cores and there are 4 NUMA nodes (4 cores on each) on it, but this function returns 32 when called)

Thanks, Ajay

ajay saini
  • 305
  • 1
  • 2
  • 8
  • Read wikipage about [application checkpointing](http://en.wikipedia.org/wiki/Checkpoint_restart) it has some pointers to kernel-assisted checkpointing.... (whose source code you might study). – Basile Starynkevitch Aug 29 '13 at 19:09
  • hey @BasileStarynkevitch, I am working on BLCR code (mentioned in the wiki page above), it doesnot have this information (page to NUMA node mapping). – ajay saini Aug 29 '13 at 19:17
  • Then ask on some kernel dedicated mailing list or forum. http://kernelnewbies.org/ or https://lkml.org/ – Basile Starynkevitch Aug 29 '13 at 19:19

1 Answers1

3

You can read "Understanding the Linux Virtual Memory Manager", it states that:

node id: This is the Node ID (NID) of the node ...

So I'm pretty sure that page_to_nid should be the right function.

Konstantin Weitz
  • 6,180
  • 8
  • 26
  • 43
  • 2
    yes, page_to_nid(), does give the correct numa nodeid .... I updated my code and did comparison with /proc//numa_maps file and the data matched – ajay saini Sep 03 '13 at 16:34