title: Allocating a Thread's Stack on a specific NUMA memory
body: <p>I would like to know if there is a way to create the stack of a thread on a specific NUMA node.
  I have written this code but i'm not sure if it does the trick or not.</p>
  
  <pre class="lang-c prettyprint-override"><code>pthread_t thread1;
  
  int main(int argc, char**argv) {        
    pthread_attr_t attr;
    pthread_attr_init(&amp;attr);
  
    char** stackarray;
    int numanode = 1;
  
    stackarray = (char**) numa_alloc_onnode(sizeof(char*), numanode);
    // considering that the newly 
    // created thread will be running on a core on node1
  
    pthread_attr_setstack(&amp;attr, stackarray[0], 1000000);
    pthread_create(&amp;thread1, &amp;attr, function, (void*)0);
  
    ...
    ...
  }
  </code></pre>
  
  <p>Thank you for your help    </p>