Back to index

numactl  2.0.8~rc4
Defines | Functions
migratepages.c File Reference
#include <getopt.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include "numa.h"
#include "numaif.h"
#include "numaint.h"
#include "util.h"

Go to the source code of this file.

Defines

#define _GNU_SOURCE

Functions

void usage (void)
void checknuma (void)
int main (int argc, char *argv[])

Define Documentation

#define _GNU_SOURCE

Definition at line 21 of file migratepages.c.


Function Documentation

void checknuma ( void  )

Definition at line 49 of file migratepages.c.

{
       static int numa = -1;
       if (numa < 0) {
              if (numa_available() < 0)
                     complain("This system does not support NUMA functionality");
       }
       numa = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 59 of file migratepages.c.

{
       int c;
       char *end;
       int rc;
       int pid;
       struct bitmask *fromnodes;
       struct bitmask *tonodes;

       while ((c = getopt_long(argc,argv,"h", opts, NULL)) != -1) {
              switch (c) {
              default:
                     usage();
              }
       }

       argv += optind;
       argc -= optind;

       if (argc != 3)
              usage();

       checknuma();

       pid = strtoul(argv[0], &end, 0);
       if (*end || end == argv[0])
              usage();

       fromnodes = numa_parse_nodestring(argv[1]);
       if (!fromnodes) {
              printf ("<%s> is invalid\n", argv[1]);
              exit(1);
       }
       tonodes = numa_parse_nodestring(argv[2]);
       if (!tonodes) {
              printf ("<%s> is invalid\n", argv[2]);
              exit(1);
       }

       rc = numa_migrate_pages(pid, fromnodes, tonodes);

       if (rc < 0) {
              perror("migrate_pages");
              return 1;
       }
       return 0;
}

Here is the call graph for this function:

void usage ( void  )

Definition at line 39 of file migratepages.c.

{
       fprintf(stderr,
              "usage: migratepages pid from-nodes to-nodes\n"
              "\n"
              "nodes is a comma delimited list of node numbers or A-B ranges or all.\n"
);
       exit(1);
}