All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
To: dvr <jinxiu.1006-9Onoh4P/yGk@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org
Subject: Re: Get the socket id
Date: Wed, 7 Aug 2013 08:52:41 -0700	[thread overview]
Message-ID: <20130807085241.684ed79a@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <77584a69.d001.1405769661d.Coremail.jinxiu.1006-9Onoh4P/yGk@public.gmane.org>

On Wed, 7 Aug 2013 14:14:19 +0800 (CST)
dvr <jinxiu.1006-9Onoh4P/yGk@public.gmane.org> 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.

  parent reply	other threads:[~2013-08-07 15:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07  6:14 Get the socket id dvr
     [not found] ` <77584a69.d001.1405769661d.Coremail.jinxiu.1006-9Onoh4P/yGk@public.gmane.org>
2013-08-07 15:52   ` Stephen Hemminger [this message]
     [not found]     ` <20130807085241.684ed79a-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2013-08-07 15:56       ` Damien Millescamps
     [not found]         ` <52026E47.6090402-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-08-07 16:11           ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130807085241.684ed79a@nehalam.linuxnetplumber.net \
    --to=stephen-otpzqlsittunbdjkjebofr2eb7je58tq@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=jinxiu.1006-9Onoh4P/yGk@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.