mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: girish <girishvg@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: William Pitcock <nenolod@atheme.org>, girishvg@gmail.com
Subject: Re: [PATCH] include children count, in Threads: field present in /proc/<pid>/status (take-1)
Date: Sat, 30 Sep 2006 01:51:31 +0900	[thread overview]
Message-ID: <EE7C757E-E2CE-4617-A1D4-3B8F5E3E8240@gmail.com> (raw)
In-Reply-To: <F2F2C98F-6AFB-4E19-BEE9-D32652E2F478@atheme.org>


On Sep 30, 2006, at 1:31 AM, William Pitcock wrote:

>
> On Sep 29, 2006, at 10:18 AM, girish wrote:
>
>>
>> -	buffer += sprintf(buffer, "Threads:\t%d\n", num_threads);
>> +	buffer += sprintf(buffer, "Threads:\t%d\n", num_threads +  
>> num_children);
>
> Personally, I'd prefer the children count to be separate, something  
> like:
>
> buffer += sprintf(buffer, "Threads:\t%d (%d children, %d total)",  
> num_threads, num_children, num_threads + num_children);
>
> That would be rather nice, indeed.
>
> Also, next time, make sure that linux-kernel is CC'd, not BCC'd.
>
> ---
> William Pitcock
> nenolod@atheme.org
> http://people.atheme.org/~nenolod/
> http://nenolod.net
>
>

Agree.  It indeed look better. I too had an awk script in mind, to  
parse the line.  I ended up removing such formatting, because not all  
process spawn child thread(s), showing num_children count as zero.  
That looked bit odd. So here it is again - new wine.

Thanks.

Signed-off-by: Girish V. Gulawani <girishvg@gmail.com>
--- linux-vanilla/fs/proc/array.c	2006-09-20 12:42:06.000000000 +0900
+++ linux/fs/proc/array.c	2006-09-30 01:47:25.000000000 +0900
@@ -248,6 +248,8 @@ static inline char * task_sig(struct tas
  	int num_threads = 0;
  	unsigned long qsize = 0;
  	unsigned long qlim = 0;
+	int num_children = 0;
+	struct list_head *_p;

  	sigemptyset(&pending);
  	sigemptyset(&shpending);
@@ -268,9 +270,14 @@ static inline char * task_sig(struct tas
  		qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur;
  		spin_unlock_irq(&p->sighand->siglock);
  	}
+	list_for_each(_p, &p->children)
+		++num_children;
  	read_unlock(&tasklist_lock);

-	buffer += sprintf(buffer, "Threads:\t%d\n", num_threads);
+	buffer += sprintf(buffer, "Threads:\t%d", num_threads);
+	if (num_children)
+		buffer += sprintf(buffer, " (%d children, %d total)",  
num_children, num_threads + num_children);
+	buffer += sprintf(buffer, "\n");
  	buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim);

  	/* render them all */

  reply	other threads:[~2006-09-29 16:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29 15:18 girish
2006-09-29 16:31 ` William Pitcock
2006-09-29 16:51   ` girish [this message]
2006-09-29 17:06     ` Jan Engelhardt
2006-09-29 17:18       ` girish
2006-09-29 18:12         ` Jan Engelhardt
2006-09-29 18:24           ` [PATCH] include children count, in Threads: field present in /proc/<pid>/status (take-3) girish
2006-09-29 22:51             ` Eric W. Biederman
     [not found]               ` <E78297DA-5F0F-40FA-A008-89264570B313@gmail.com>
2006-09-30 17:11                 ` Jan Engelhardt
2006-10-01 11:34                   ` girish

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=EE7C757E-E2CE-4617-A1D4-3B8F5E3E8240@gmail.com \
    --to=girishvg@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nenolod@atheme.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 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®