public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Use task_pid_nr() instead of pid_nr(task_pid())
@ 2007-10-03 14:26 Pavel Emelyanov
  2007-10-05 23:15 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Emelyanov @ 2007-10-03 14:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux Kernel Mailing List, devel, H. Peter Anvin, Paul Menage

There are two places that do so - the cgroups subsystem 
and the autofs code.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 592f640..5efff3c 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -214,7 +214,7 @@ static struct dentry *autofs_root_lookup
 
 	oz_mode = autofs_oz_mode(sbi);
 	DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
-				"oz_mode = %d\n", pid_nr(task_pid(current)),
+				"oz_mode = %d\n", task_pid_nr(current),
 				task_pgrp_nr(current), sbi->catatonic,
 				oz_mode));
 
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 1e8aa53..8720881 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1762,7 +1762,7 @@ static int pid_array_load(pid_t *pidarra
 	while ((tsk = cgroup_iter_next(cont, &it))) {
 		if (unlikely(n == npids))
 			break;
-		pidarray[n++] = pid_nr(task_pid(tsk));
+		pidarray[n++] = task_pid_nr(tsk);
 	}
 	cgroup_iter_end(cont, &it);
 	return n;


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

* Re: [PATCH] Use task_pid_nr() instead of pid_nr(task_pid())
  2007-10-03 14:26 [PATCH] Use task_pid_nr() instead of pid_nr(task_pid()) Pavel Emelyanov
@ 2007-10-05 23:15 ` Andrew Morton
  2007-10-08  8:57   ` Pavel Emelyanov
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2007-10-05 23:15 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: linux-kernel, devel, hpa, menage

On Wed, 03 Oct 2007 18:26:06 +0400
Pavel Emelyanov <xemul@openvz.org> wrote:

> There are two places that do so - the cgroups subsystem 
> and the autofs code.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 
> ---
> 
> diff --git a/fs/autofs/root.c b/fs/autofs/root.c
> index 592f640..5efff3c 100644
> --- a/fs/autofs/root.c
> +++ b/fs/autofs/root.c
> @@ -214,7 +214,7 @@ static struct dentry *autofs_root_lookup
>  
>  	oz_mode = autofs_oz_mode(sbi);
>  	DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
> -				"oz_mode = %d\n", pid_nr(task_pid(current)),
> +				"oz_mode = %d\n", task_pid_nr(current),
>  				task_pgrp_nr(current), sbi->catatonic,
>  				oz_mode));
>  
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 1e8aa53..8720881 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1762,7 +1762,7 @@ static int pid_array_load(pid_t *pidarra
>  	while ((tsk = cgroup_iter_next(cont, &it))) {
>  		if (unlikely(n == npids))
>  			break;
> -		pidarray[n++] = pid_nr(task_pid(tsk));
> +		pidarray[n++] = task_pid_nr(tsk);
>  	}
>  	cgroup_iter_end(cont, &it);
>  	return n;

And more will appear over time unless we remove pid_nr() altogether.

Can we do that?

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

* Re: [PATCH] Use task_pid_nr() instead of pid_nr(task_pid())
  2007-10-05 23:15 ` Andrew Morton
@ 2007-10-08  8:57   ` Pavel Emelyanov
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Emelyanov @ 2007-10-08  8:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, devel, hpa, menage

Andrew Morton wrote:
> On Wed, 03 Oct 2007 18:26:06 +0400
> Pavel Emelyanov <xemul@openvz.org> wrote:
> 
>> There are two places that do so - the cgroups subsystem 
>> and the autofs code.
>>
>> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
>>
>> ---
>>
>> diff --git a/fs/autofs/root.c b/fs/autofs/root.c
>> index 592f640..5efff3c 100644
>> --- a/fs/autofs/root.c
>> +++ b/fs/autofs/root.c
>> @@ -214,7 +214,7 @@ static struct dentry *autofs_root_lookup
>>  
>>  	oz_mode = autofs_oz_mode(sbi);
>>  	DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
>> -				"oz_mode = %d\n", pid_nr(task_pid(current)),
>> +				"oz_mode = %d\n", task_pid_nr(current),
>>  				task_pgrp_nr(current), sbi->catatonic,
>>  				oz_mode));
>>  
>> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
>> index 1e8aa53..8720881 100644
>> --- a/kernel/cgroup.c
>> +++ b/kernel/cgroup.c
>> @@ -1762,7 +1762,7 @@ static int pid_array_load(pid_t *pidarra
>>  	while ((tsk = cgroup_iter_next(cont, &it))) {
>>  		if (unlikely(n == npids))
>>  			break;
>> -		pidarray[n++] = pid_nr(task_pid(tsk));
>> +		pidarray[n++] = task_pid_nr(tsk);
>>  	}
>>  	cgroup_iter_end(cont, &it);
>>  	return n;
> 
> And more will appear over time unless we remove pid_nr() altogether.
> 
> Can we do that?

Hardly. 

There are places that store the struct pid and try to obtain its number
later. E.g. tiocgpgrp() wants to tell user the pgrp nr of the tty's 
active group; fgetown() tells user the number of file's owner pid or (!)
pgrp; file locks need to store the pid and report it later (this is not 
implemented yet, I'm still working on it) and so on and so forth.

Thanks,
Pavel

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

end of thread, other threads:[~2007-10-08  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-03 14:26 [PATCH] Use task_pid_nr() instead of pid_nr(task_pid()) Pavel Emelyanov
2007-10-05 23:15 ` Andrew Morton
2007-10-08  8:57   ` Pavel Emelyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox