mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Terje Eggestad <terje.eggestad@scali.no>
To: Robert Love <rml@tech9.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] processes with shared vm
Date: 17 Aug 2001 10:04:04 +0200	[thread overview]
Message-ID: <998035444.7627.4.camel@pc-16.office.scali.no> (raw)
In-Reply-To: <998035017.663.13.camel@phantasy>
In-Reply-To: <997973469.7632.10.camel@pc-16>  <998035017.663.13.camel@phantasy>

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

OK

Den 17 Aug 2001 03:56:49 -0400, skrev Robert Love:
> On 17 Aug 2001 09:50:06 +0200, Terje Eggestad wrote:
> > I figured out that it's difficult to find out from /proc
> > which processes that share VM (created with clone(CLONE_VM)). 
> 
> good idea, but use diff -u
> 
> -- 
> Robert M. Love
> rml at ufl.edu
> rml at tech9.net


--- array.c     Thu Aug 16 16:33:56 2001
+++ array.c.orig        Mon Mar 19 21:34:55 2001
@@ -50,12 +50,6 @@
  * Al Viro & Jeff Garzik :  moved most of the thing into base.c and
  *                      :  proc_misc.c. The rest may eventually go into
  *                      :  base.c too.
- *
- * Terje Eggestad    :  added in /proc/<pid>/status a VmClones: n
- *                   :  that tells how many proc that uses the same VM
(mm_struct).
- *                   :  if there are clones add another field
VmFirstClone with the
- *                   :  clone with the lowest pid. Needed for things
like gtop that adds 
- *                   :  mem usage of groups of proc, or else they add
up the usage of threads.
  */
 
 #include <linux/config.h>
@@ -184,7 +178,7 @@
 static inline char * task_mem(struct mm_struct *mm, char *buffer)
 {
        struct vm_area_struct * vma;
-       unsigned long data = 0, stack = 0;
+       unsigned long data = 0, stack = 0;
        unsigned long exec = 0, lib = 0;
 
        down_read(&mm->mmap_sem);
@@ -212,24 +206,12 @@
                "VmData:\t%8lu kB\n"
                "VmStk:\t%8lu kB\n"
                "VmExe:\t%8lu kB\n"
-               "VmLib:\t%8lu kB\n"
-               "VmClones:\t%d\n",
+               "VmLib:\t%8lu kB\n",
                mm->total_vm << (PAGE_SHIFT-10),
                mm->locked_vm << (PAGE_SHIFT-10),
                mm->rss << (PAGE_SHIFT-10),
                data - stack, stack,
-               exec - lib, lib, 
-               mm->mm_users.counter-2);
-       /* if we've vm clones, find the lowest/first pid of the clones
*/
-       if (mm->mm_users.counter > 2) {
-         struct task_struct *p;
-         read_lock(&tasklist_lock);
-         for_each_task(p) {
-           if (p->mm == mm) break;
-         };
-         buffer += sprintf(buffer, "VmFirstClone:\t%d\n", p->pid);
-         read_unlock(&tasklist_lock);
-       };
+               exec - lib, lib);
        up_read(&mm->mmap_sem);
        return buffer;
 }


-- 
_________________________________________________________________________

Terje Eggestad                  terje.eggestad@scali.no
Scali Scalable Linux Systems    http://www.scali.com

Olaf Helsets Vei 6              tel:    +47 22 62 89 61 (OFFICE)
P.O.Box 70 Bogerud                      +47 975 31 574  (MOBILE)
N-0621 Oslo                     fax:    +47 22 62 89 51
NORWAY            
_________________________________________________________________________

[-- Attachment #2: vmclone.patch --]
[-- Type: text/plain, Size: 1693 bytes --]

--- array.c	Thu Aug 16 16:33:56 2001
+++ array.c.orig	Mon Mar 19 21:34:55 2001
@@ -50,12 +50,6 @@
  * Al Viro & Jeff Garzik :  moved most of the thing into base.c and
  *			 :  proc_misc.c. The rest may eventually go into
  *			 :  base.c too.
- *
- * Terje Eggestad    :  added in /proc/<pid>/status a VmClones: n
- *                   :  that tells how many proc that uses the same VM (mm_struct).
- *                   :  if there are clones add another field VmFirstClone with the
- *                   :  clone with the lowest pid. Needed for things like gtop that adds 
- *                   :  mem usage of groups of proc, or else they add up the usage of threads.
  */
 
 #include <linux/config.h>
@@ -184,7 +178,7 @@
 static inline char * task_mem(struct mm_struct *mm, char *buffer)
 {
 	struct vm_area_struct * vma;
- 	unsigned long data = 0, stack = 0;
+	unsigned long data = 0, stack = 0;
 	unsigned long exec = 0, lib = 0;
 
 	down_read(&mm->mmap_sem);
@@ -212,24 +206,12 @@
 		"VmData:\t%8lu kB\n"
 		"VmStk:\t%8lu kB\n"
 		"VmExe:\t%8lu kB\n"
-		"VmLib:\t%8lu kB\n"
-		"VmClones:\t%d\n",
+		"VmLib:\t%8lu kB\n",
 		mm->total_vm << (PAGE_SHIFT-10),
 		mm->locked_vm << (PAGE_SHIFT-10),
 		mm->rss << (PAGE_SHIFT-10),
 		data - stack, stack,
-		exec - lib, lib, 
-		mm->mm_users.counter-2);
-	/* if we've vm clones, find the lowest/first pid of the clones */	
-	if (mm->mm_users.counter > 2) {
-	  struct task_struct *p;
-	  read_lock(&tasklist_lock);
-	  for_each_task(p) {
-	    if (p->mm == mm) break;
-	  };
-	  buffer += sprintf(buffer, "VmFirstClone:\t%d\n", p->pid);
-	  read_unlock(&tasklist_lock);
-	};
+		exec - lib, lib);
 	up_read(&mm->mmap_sem);
 	return buffer;
 }

  parent reply	other threads:[~2001-08-17  8:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-17  7:50 Terje Eggestad
2001-08-17  7:56 ` Robert Love
2001-08-17  8:08   ` Robert Love
2001-08-17  8:04 ` Terje Eggestad [this message]
2001-08-17  8:15   ` Terje Eggestad
2001-08-17 12:26     ` michael
2001-08-18 14:15       ` Terje Eggestad
2001-08-19  6:24         ` Albert D. Cahalan
2001-08-19 12:23           ` Terje Eggestad
2001-08-19 23:25             ` Albert D. Cahalan
     [not found] <997973469.7632.10.camel@pc-16.suse.lists.linux.kernel>
2001-08-17  8:21 ` Andi Kleen
2001-08-17 14:26   ` Dave McCracken
2001-08-17 20:55     ` Andi Kleen
2001-08-17 21:15     ` Dave McCracken
2001-08-18 13:29       ` Terje Eggestad
2001-08-31 23:53       ` Mike Touloumtzis
2001-08-17  8:31 ` Robert Love
2001-08-17  8:46 ` Terje Eggestad
     [not found] <Pine.LNX.4.10.10108171428450.21522-100000@coffee.psychology.mcmaster.ca>
     [not found] ` <Pine.LNX.4.10.10108171428450.21522-100000@coffee.psychology.mcm aster.ca>
2001-08-17 14:39   ` Dave McCracken

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=998035444.7627.4.camel@pc-16.office.scali.no \
    --to=terje.eggestad@scali.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@tech9.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®