public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@openvz.org>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Andrew Morton <akpm@osdl.org>,
	Sukadev Bhattiprolu <sukadev@us.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devel@openvz.org, Matt Mackall <mpm@selenic.com>
Subject: Re: [PATCH 1/3] Introduce the dummy_pid
Date: Thu, 04 Oct 2007 12:56:37 +0400	[thread overview]
Message-ID: <4704AAC5.2040701@openvz.org> (raw)
In-Reply-To: <20071003110610.08156d75.randy.dunlap@oracle.com>

Randy Dunlap wrote:
> On Wed, 03 Oct 2007 18:19:01 +0400 Pavel Emelyanov wrote:
> 
>> This is a pid which is attached to tasks when they detach
>> their pids. This is done in detach_pid() and transfer_pid().
>> The pid_alive() check is changed to reflect this fact.
>>
>> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
>>
>> ---
>>
>> diff --git a/include/linux/sched.h b/include/linux/sched.h
>> index 4f21af1..e17b8f8 100644
>> --- a/include/linux/sched.h
>> +++ b/include/linux/sched.h
>> @@ -1286,9 +1286,11 @@ static inline pid_t task_ppid_nr_ns(stru
>>   * If pid_alive fails, then pointers within the task structure
>>   * can be stale and must not be dereferenced.
>>   */
>> +extern struct pid dummy_pid;
>> +
>>  static inline int pid_alive(struct task_struct *p)
>>  {
>> -	return p->pids[PIDTYPE_PID].pid != NULL;
>> +	return p->pids[PIDTYPE_PID].pid != &dummy_pid;
>>  }
>>  
>>  /**
>> diff --git a/kernel/pid.c b/kernel/pid.c
>> index d7388d7..b7a11cf 100644
>> --- a/kernel/pid.c
>> +++ b/kernel/pid.c
>> @@ -81,6 +81,17 @@ struct pid_namespace init_pid_ns = {
>>  };
>>  EXPORT_SYMBOL_GPL(init_pid_ns);
>>  
>> +struct pid dummy_pid = {
>> +	.count 		= ATOMIC_INIT(1),
>> +	.numbers	= { {
>> +		.nr		= 0,		/* this is what pid_nr will return
>> +						 * for tasks with no pids
>> +						 */
>> +		.ns		= &init_pid_ns,
>> +	}, }
>> +};
>> +EXPORT_SYMBOL(dummy_pid);
> 
> Why is the EXPORT_SYMBOL() needed?

Because pid_alive() uses it and is declared in sched.h, so
some module can use it.

> IOW, is some loadable module going to use this?

Right now - no modules use it. You're right - I will remove this export.

> ---
> ~Randy
> 


  reply	other threads:[~2007-10-04  9:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03 14:16 [PATCH 0/3] Make tasks always have non-zero pids Pavel Emelyanov
2007-10-03 14:19 ` [PATCH 1/3] Introduce the dummy_pid Pavel Emelyanov
2007-10-03 18:06   ` Randy Dunlap
2007-10-04  8:56     ` Pavel Emelyanov [this message]
2007-10-03 14:20 ` [PATCH 2/3] Prepare pid_nr() etc functions to work with not-NULL pids Pavel Emelyanov
2007-10-03 16:42   ` Matt Mackall
2007-10-04  8:54     ` Pavel Emelyanov
2007-10-04 17:13       ` Matt Mackall
2007-10-05 13:16         ` Pavel Emelyanov
2007-10-03 14:23 ` [PATCH 3/3] Use the __pid_nr() calls where appropriate Pavel Emelyanov
2007-10-05  5:53 ` [PATCH 0/3] Make tasks always have non-zero pids sukadev

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=4704AAC5.2040701@openvz.org \
    --to=xemul@openvz.org \
    --cc=akpm@osdl.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=randy.dunlap@oracle.com \
    --cc=sukadev@us.ibm.com \
    /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