Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-19 Thread Oleg Nesterov
On 08/19, Neil Horman wrote: > Copy That > > Currently, there exists no method for a process to query the resource > limits of another process. They can be inferred via some mechanisms but > they cannot be explicitly determined. Given that this information can be > usefull to know during the

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-19 Thread Neil Horman
Copy That Currently, there exists no method for a process to query the resource limits of another process. They can be inferred via some mechanisms but they cannot be explicitly determined. Given that this information can be usefull to know during the debugging of an application, I've written

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-19 Thread Oleg Nesterov
On 08/18, Neil Horman wrote: > > +static int proc_pid_limits(struct task_struct *task, char *buffer) > +{ > + unsigned int i; > + int count = 0; > + unsigned long flags; > + char *bufptr = buffer; > + > + struct rlimit rlim[RLIM_NLIMITS]; > + > + rcu_read_lock(); > +

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-19 Thread Oleg Nesterov
On 08/18, Neil Horman wrote: +static int proc_pid_limits(struct task_struct *task, char *buffer) +{ + unsigned int i; + int count = 0; + unsigned long flags; + char *bufptr = buffer; + + struct rlimit rlim[RLIM_NLIMITS]; + + rcu_read_lock(); +

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-19 Thread Neil Horman
Copy That Currently, there exists no method for a process to query the resource limits of another process. They can be inferred via some mechanisms but they cannot be explicitly determined. Given that this information can be usefull to know during the debugging of an application, I've written

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-19 Thread Oleg Nesterov
On 08/19, Neil Horman wrote: Copy That Currently, there exists no method for a process to query the resource limits of another process. They can be inferred via some mechanisms but they cannot be explicitly determined. Given that this information can be usefull to know during the

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Neil Horman
> > Neil, please, don't add tasklist_lock again. It was not easy to wipe it from > fs/proc/ :) Just change this code to use rcu_read_lock(). > Ok, done/tested. Thanks! Currently, there exists no method for a process to query the resource limits of another process. They can be inferred via

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Oleg Nesterov
On 08/18, Neil Horman wrote: > > +static int proc_pid_limits(struct task_struct *task, char *buffer) > +{ > + unsigned int i; > + int count = 0; > + unsigned long flags; > + char *bufptr = buffer; > + > + struct rlimit rlim[RLIM_NLIMITS]; > + > + read_lock(_lock); > +

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Neil Horman
Ok, I think I see your point. Thanks for the input. New patch attached which adds the use of the sighand lock to the patch. Currently, there exists no method for a process to query the resource limits of another process. They can be inferred via some mechanisms but they cannot be explicitly

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Oleg Nesterov
On 08/18, Neil Horman wrote: > > On Sat, Aug 18, 2007 at 02:22:28AM +0400, Oleg Nesterov wrote: > > Neil Horman wrote: > > > > > > +static int proc_pid_limits(struct task_struct *task, char *buffer) > > > +{ > > > + unsigned int i; > > > + int count = 0; > > > + char *bufptr = buffer; > > > + > >

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Neil Horman
On Sat, Aug 18, 2007 at 02:22:28AM +0400, Oleg Nesterov wrote: > Neil Horman wrote: > > > > +static int proc_pid_limits(struct task_struct *task, char *buffer) > > +{ > > + unsigned int i; > > + int count = 0; > > + char *bufptr = buffer; > > + > > + struct rlimit rlim[RLIM_NLIMITS]; > >

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Neil Horman
On Sat, Aug 18, 2007 at 02:22:28AM +0400, Oleg Nesterov wrote: Neil Horman wrote: +static int proc_pid_limits(struct task_struct *task, char *buffer) +{ + unsigned int i; + int count = 0; + char *bufptr = buffer; + + struct rlimit rlim[RLIM_NLIMITS]; + +

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Oleg Nesterov
On 08/18, Neil Horman wrote: On Sat, Aug 18, 2007 at 02:22:28AM +0400, Oleg Nesterov wrote: Neil Horman wrote: +static int proc_pid_limits(struct task_struct *task, char *buffer) +{ + unsigned int i; + int count = 0; + char *bufptr = buffer; + + struct rlimit

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Neil Horman
Ok, I think I see your point. Thanks for the input. New patch attached which adds the use of the sighand lock to the patch. Currently, there exists no method for a process to query the resource limits of another process. They can be inferred via some mechanisms but they cannot be explicitly

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Oleg Nesterov
On 08/18, Neil Horman wrote: +static int proc_pid_limits(struct task_struct *task, char *buffer) +{ + unsigned int i; + int count = 0; + unsigned long flags; + char *bufptr = buffer; + + struct rlimit rlim[RLIM_NLIMITS]; + + read_lock(tasklist_lock); +

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-18 Thread Neil Horman
Neil, please, don't add tasklist_lock again. It was not easy to wipe it from fs/proc/ :) Just change this code to use rcu_read_lock(). Ok, done/tested. Thanks! Currently, there exists no method for a process to query the resource limits of another process. They can be inferred via some

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-17 Thread Oleg Nesterov
Neil Horman wrote: > > +static int proc_pid_limits(struct task_struct *task, char *buffer) > +{ > + unsigned int i; > + int count = 0; > + char *bufptr = buffer; > + > + struct rlimit rlim[RLIM_NLIMITS]; > + > + read_lock(_lock); > + memcpy(rlim, task->signal->rlim,

Re: + proc-export-a-processes-resource-limits-via-proc-pid.patch added to -mm tree

2007-08-17 Thread Oleg Nesterov
Neil Horman wrote: +static int proc_pid_limits(struct task_struct *task, char *buffer) +{ + unsigned int i; + int count = 0; + char *bufptr = buffer; + + struct rlimit rlim[RLIM_NLIMITS]; + + read_lock(tasklist_lock); + memcpy(rlim, task-signal-rlim,