DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Get the socket id
@ 2013-08-07  6:14 dvr
  2013-08-07 15:52 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: dvr @ 2013-08-07  6:14 UTC (permalink / raw)
  To: dev

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

hi,
   all
   I'm confused with the following code(Eal_memory.c in lib\librte_eal\linuxapp\eal directory, LINE 373):
 
   nodestr = strstr(buf," N");
   if(nodestr == NULL) {...}
   nodestr += 2;
   end = strstr(nodestr,"=");
   if(end == NULL) {...}
   // here nodestr = "0=1"
   end[0] = '\0';
   end = NULL;
  // here nodestr = "0"
   socket_id = strtoul(nodestr,&end,0);
 
   Through "printf", I know that:
   buf = "00200000 default file=/mnt/dpdk/huge/rtemap_1 huge dirty=1 N0=1"
   And finally socket_id=0
   My question is :why we get the socket_id before "=" instead of after "=" ?
   and if we want to get the character after "N", isn't this code too complex?
 
   I will be very appreciate for any help.
   Regards!
 
Maria
  

[-- Attachment #2: Type: text/html, Size: 1560 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Get the socket id
  2013-08-07  6:14 [dpdk-dev] Get the socket id dvr
@ 2013-08-07 15:52 ` Stephen Hemminger
  2013-08-07 15:56   ` Damien Millescamps
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2013-08-07 15:52 UTC (permalink / raw)
  To: dvr; +Cc: dev

On Wed, 7 Aug 2013 14:14:19 +0800 (CST)
dvr <jinxiu.1006@163.com> wrote:

> hi,
>    all
>    I'm confused with the following code(Eal_memory.c in lib\librte_eal\linuxapp\eal directory, LINE 373):
>  
>    nodestr = strstr(buf," N");
>    if(nodestr == NULL) {...}
>    nodestr += 2;
>    end = strstr(nodestr,"=");
>    if(end == NULL) {...}
>    // here nodestr = "0=1"
>    end[0] = '\0';
>    end = NULL;
>   // here nodestr = "0"
>    socket_id = strtoul(nodestr,&end,0);
>  
>    Through "printf", I know that:
>    buf = "00200000 default file=/mnt/dpdk/huge/rtemap_1 huge dirty=1 N0=1"
>    And finally socket_id=0
>    My question is :why we get the socket_id before "=" instead of after "=" ?
>    and if we want to get the character after "N", isn't this code too complex?
>  
>    I will be very appreciate for any help.
>    Regards!
>  
> Maria
>   

Good question.

The best reference for the kernel proc files is usually in the Linux
kernel source Documentation directory. But can't find any documentation
on numa_maps in detail.

Inside kernel VM, there is an array of numa_maps for each process.
The two parts of NX=Y are:
   X => the numa map index
   Y => the numa node associated with that map

Therefore it is possible to have multiple entries, like:
 "00200000 default file=/myfile dirty=1 N0=1 N1=2"
if the the memory region crosses multiple NUMA nodes.
Since huge pages are pinned to numa node, you won't see that for them.
Basically if "huge" is in the line only one NX=Y entry will be present;
and the X part is unimportant.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Get the socket id
  2013-08-07 15:52 ` Stephen Hemminger
@ 2013-08-07 15:56   ` Damien Millescamps
  2013-08-07 16:11     ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Millescamps @ 2013-08-07 15:56 UTC (permalink / raw)
  To: dev

On 08/07/2013 05:52 PM, Stephen Hemminger wrote:
> But can't find any documentation
> on numa_maps in detail.
You should try with man 5 numa_maps.

-- 
Damien Millescamps

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Get the socket id
  2013-08-07 15:56   ` Damien Millescamps
@ 2013-08-07 16:11     ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2013-08-07 16:11 UTC (permalink / raw)
  To: Damien Millescamps; +Cc: dev

On Wed, 07 Aug 2013 17:56:55 +0200
Damien Millescamps <damien.millescamps@6wind.com> wrote:

> On 08/07/2013 05:52 PM, Stephen Hemminger wrote:
> > But can't find any documentation
> > on numa_maps in detail.
> You should try with man 5 numa_maps.
> 

Thanks, knew it was there some where:
       N<node>=<nr_pages>
              The number of pages allocated on  <node>.   <nr_pages>  includes
              only  pages currently mapped by the process.  Page migration and
              memory reclaim may have temporarily  unmapped  pages  associated
              with  this  memory  range.   These  pages may only show up again
              after the process has attempted to reference them.  If the  mem‐
              ory range represents a shared memory area or file mapping, other
              processes may currently have additional pages mapped in a corre‐
              sponding memory range.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-07 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07  6:14 [dpdk-dev] Get the socket id dvr
2013-08-07 15:52 ` Stephen Hemminger
2013-08-07 15:56   ` Damien Millescamps
2013-08-07 16:11     ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).