util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question about lsns.
@ 2018-09-20 13:24 L A Walsh
  2018-09-24 13:02 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: L A Walsh @ 2018-09-20 13:24 UTC (permalink / raw)
  To: util-linux

I came across lsns and decided to see what ns's it might list on my
system.

as my self,
>  lsns
        NS TYPE   NPROCS   PID USER COMMAND
4026531835 cgroup     21 22959 law  gvim prelink_dependencies
4026531836 pid        21 22959 law  gvim prelink_dependencies
4026531837 user       21 22959 law  gvim prelink_dependencies
4026531838 uts        21 22959 law  gvim prelink_dependencies
4026531839 ipc        21 22959 law  gvim prelink_dependencies
4026531840 mnt        21 22959 law  gvim prelink_dependencies
4026531992 net        21 22959 law  gvim prelink_dependencies

and as root:

# lsns
        NS TYPE   NPROCS PID USER COMMAND
4026531835 cgroup    429   1 root init [3]        
4026531836 pid       429   1 root init [3]        
4026531837 user      429   1 root init [3]        
4026531838 uts       429   1 root init [3]        
4026531839 ipc       429   1 root init [3]        
4026531840 mnt       428   1 root init [3]        
4026531860 mnt         1  82 root kdevtmpfs
4026531992 net       429   1 root init [3]

-----------------

To me this seems a bit odd as I don't recall doing and nsenter or creation
commands, though there may be some tucked away in some script or another.

But why these?

a gvim editor session (I hve several files up, but don't know if they are
all in the same ns.  It doesn't seem the lsns has a way to list what the
other procs are in the name space (might be useful rather than going
and looking at the hierarchy).

And for root....an init cmd that seems to have a nproc value rough equal
to the number of procs running.

Not sure what NPROCS means...a ps -ef|grep law shows 81 procs, but weeding
out the ones that appear to be threads, I get 35, so not sure where
nprocs gets 21.

Is this a result of auto-grouping by the the scheduler?
Seems odd it points at an edit session as the command that is
in the ns and not a bash or ssh login...

Thanks!
-l

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

* Re: question about lsns.
  2018-09-20 13:24 question about lsns L A Walsh
@ 2018-09-24 13:02 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2018-09-24 13:02 UTC (permalink / raw)
  To: L A Walsh; +Cc: util-linux

On Thu, Sep 20, 2018 at 06:24:55AM -0700, L A Walsh wrote:
> I came across lsns and decided to see what ns's it might list on my
> system.
> 
> as my self,
> >  lsns
>        NS TYPE   NPROCS   PID USER COMMAND
> 4026531835 cgroup     21 22959 law  gvim prelink_dependencies
> 4026531836 pid        21 22959 law  gvim prelink_dependencies
> 4026531837 user       21 22959 law  gvim prelink_dependencies
> 4026531838 uts        21 22959 law  gvim prelink_dependencies
> 4026531839 ipc        21 22959 law  gvim prelink_dependencies
> 4026531840 mnt        21 22959 law  gvim prelink_dependencies
> 4026531992 net        21 22959 law  gvim prelink_dependencies
> 
> and as root:
> 
> # lsns
>        NS TYPE   NPROCS PID USER COMMAND
> 4026531835 cgroup    429   1 root init [3]        4026531836 pid       429
> 1 root init [3]        4026531837 user      429   1 root init [3]
> 4026531838 uts       429   1 root init [3]        4026531839 ipc       429
> 1 root init [3]        4026531840 mnt       428   1 root init [3]
> 4026531860 mnt         1  82 root kdevtmpfs
> 4026531992 net       429   1 root init [3]
> 
> -----------------
> 
> To me this seems a bit odd as I don't recall doing and nsenter or creation
> commands, though there may be some tucked away in some script or another.
> 
> But why these?
> 
> a gvim editor session (I hve several files up, but don't know if they are
> all in the same ns.  It doesn't seem the lsns has a way to list what the
> other procs are in the name space (might be useful rather than going
> and looking at the hierarchy).
> 
> And for root....an init cmd that seems to have a nproc value rough equal
> to the number of procs running.
> 
> Not sure what NPROCS means...a ps -ef|grep law shows 81 procs, but weeding
> out the ones that appear to be threads, I get 35, so not sure where
> nprocs gets 21.

The way how lsns works is pretty simple. It reads all /proc/<digit>*
processes, and then group all the processes by namespaces from /proc/#/ns/*.

The NPROCS is number of members in the group of the processes. The
process with the smallest PID is the COMMAND for the namespace.

> Is this a result of auto-grouping by the the scheduler?

Do you mean kernel tasks scheduler? I don't think so.

> Seems odd it points at an edit session as the command that is
> in the ns and not a bash or ssh login...

I think the most important player is initd or init scripts.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

end of thread, other threads:[~2018-09-24 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 13:24 question about lsns L A Walsh
2018-09-24 13:02 ` Karel Zak

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).