Given a page, How to get the NUMA node id of this page

2013-08-29 Thread ajay saini
Hi all,

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)


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
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Given a page, How to get the NUMA node id of this page

2013-08-29 Thread Valdis . Kletnieks
On Fri, 30 Aug 2013 02:43:00 +0800, ajay saini said:
 I am working on a checkpoint/Restart Linux kernel module.

Have you looked at the already existing checkpoint/restart support?

(and C/R is a lot harder to get right than you think - turns out you
need all sorts of infrastructure.  The various namespaces support, for
instance, are to a large degree to allow C/R to work right.  For example,
you need PID namespaces so you can properly do C/R of a process that has
done a getpid() call - because you need to restart it with the same PID
that it had at checkpoint time.

in init/Kconfig:

config CHECKPOINT_RESTORE
bool Checkpoint/restore support if EXPERT
default n
help
  Enables additional kernel features in a sake of checkpoint/restore.
  In particular it adds auxiliary prctl codes to setup process text,
  data and heap segment sizes, and a few additional /proc filesystem
  entries.

  If unsure, say N here.

Enjoy, and don't re-invent the wheel.



pgplC3WDJ8Yzg.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Given a page, How to get the NUMA node id of this page

2013-08-29 Thread Valdis . Kletnieks
On Fri, 30 Aug 2013 04:39:14 +0800, ajay saini said:
 I am working on BLCR (a checkpoint/Restart Linux kernel module), currently it
 does not have this information.

Yes, but why are you re-inventing the wheel?  Is there a reason the existing
in-kernel support for C/R isn't usable for your situation?



pgpRxH1bnokxJ.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies