All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] init_new_context: Use the passed task argument
@ 2007-02-28  4:47 Aneesh Kumar K.V
  0 siblings, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2007-02-28  4:47 UTC (permalink / raw)
  To: Andrew Morton, andi; +Cc: linux-kernel


Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/i386/kernel/ldt.c   |    2 +-
 arch/x86_64/kernel/ldt.c |    2 +-
 kernel/fork.c            |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c
index b410e5f..925354c 100644
--- a/arch/i386/kernel/ldt.c
+++ b/arch/i386/kernel/ldt.c
@@ -97,7 +97,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 
 	init_MUTEX(&mm->context.sem);
 	mm->context.size = 0;
-	old_mm = current->mm;
+	old_mm = tsk->mm;
 	if (old_mm && old_mm->context.size > 0) {
 		down(&old_mm->context.sem);
 		retval = copy_ldt(&mm->context, &old_mm->context);
diff --git a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c
index d7e5d0c..16ae79d 100644
--- a/arch/x86_64/kernel/ldt.c
+++ b/arch/x86_64/kernel/ldt.c
@@ -101,7 +101,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 
 	init_MUTEX(&mm->context.sem);
 	mm->context.size = 0;
-	old_mm = current->mm;
+	old_mm = tsk->mm;
 	if (old_mm && old_mm->context.size > 0) {
 		down(&old_mm->context.sem);
 		retval = copy_ldt(&mm->context, &old_mm->context);
diff --git a/kernel/fork.c b/kernel/fork.c
index d154cc7..2184ef5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -477,7 +477,7 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
  */
 static struct mm_struct *dup_mm(struct task_struct *tsk)
 {
-	struct mm_struct *mm, *oldmm = current->mm;
+	struct mm_struct *mm, *oldmm = tsk->mm;
 	int err;
 
 	if (!oldmm)
@@ -551,7 +551,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
 	}
 
 	retval = -ENOMEM;
-	mm = dup_mm(tsk);
+	mm = dup_mm(current);
 	if (!mm)
 		goto fail_nomem;
 
-- 
1.5.0.1.227.g99d42-dirty


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

* Re: [PATCH] init_new_context: Use the passed task argument
  2007-02-27 20:26   ` Andrew Morton
@ 2007-02-28  4:12     ` Aneesh Kumar
  0 siblings, 0 replies; 3+ messages in thread
From: Aneesh Kumar @ 2007-02-28  4:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: andi, linux-kernel

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

On 2/28/07, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Fri, 23 Feb 2007 21:10:36 +0530 "Aneesh Kumar K.V" <aneesh.kumar@gmail.com> wrote:
> > From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
> >
> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
> > ---
> >  arch/i386/kernel/ldt.c   |    2 +-
> >  arch/x86_64/kernel/ldt.c |    2 +-
> >  kernel/fork.c            |    2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c
> > index b410e5f..925354c 100644
> > --- a/arch/i386/kernel/ldt.c
> > +++ b/arch/i386/kernel/ldt.c
> > @@ -97,7 +97,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
> >
> >       init_MUTEX(&mm->context.sem);
> >       mm->context.size = 0;
> > -     old_mm = current->mm;
> > +     old_mm = tsk->mm;
> >       if (old_mm && old_mm->context.size > 0) {
> >               down(&old_mm->context.sem);
> >               retval = copy_ldt(&mm->context, &old_mm->context);
> > diff --git a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c
> > index d7e5d0c..16ae79d 100644
> > --- a/arch/x86_64/kernel/ldt.c
> > +++ b/arch/x86_64/kernel/ldt.c
> > @@ -101,7 +101,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
> >
> >       init_MUTEX(&mm->context.sem);
> >       mm->context.size = 0;
> > -     old_mm = current->mm;
> > +     old_mm = tsk->mm;
> >       if (old_mm && old_mm->context.size > 0) {
> >               down(&old_mm->context.sem);
> >               retval = copy_ldt(&mm->context, &old_mm->context);
> > diff --git a/kernel/fork.c b/kernel/fork.c
> > index d154cc7..2423d83 100644
> > --- a/kernel/fork.c
> > +++ b/kernel/fork.c
> > @@ -496,7 +496,7 @@ static struct mm_struct *dup_mm(struct task_struct *tsk)
> >       if (!mm_init(mm))
> >               goto fail_nomem;
> >
> > -     if (init_new_context(tsk, mm))
> > +     if (init_new_context(current, mm))
> >               goto fail_nocontext;
>
> This last change makes the comment over dup_mm() wrong.  It also generally
> makes dup_mm() less useful, although that migt be OK.  It also makes the
> argument to dup_mm() unused and potentially removable.
>


How about the change as below

[-- Attachment #2: fork.diff --]
[-- Type: text/x-patch, Size: 816 bytes --]

diff --git a/kernel/fork.c b/kernel/fork.c
index 2423d83..2184ef5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -477,7 +477,7 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
  */
 static struct mm_struct *dup_mm(struct task_struct *tsk)
 {
-	struct mm_struct *mm, *oldmm = current->mm;
+	struct mm_struct *mm, *oldmm = tsk->mm;
 	int err;
 
 	if (!oldmm)
@@ -496,7 +496,7 @@ static struct mm_struct *dup_mm(struct task_struct *tsk)
 	if (!mm_init(mm))
 		goto fail_nomem;
 
-	if (init_new_context(current, mm))
+	if (init_new_context(tsk, mm))
 		goto fail_nocontext;
 
 	err = dup_mmap(mm, oldmm);
@@ -551,7 +551,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
 	}
 
 	retval = -ENOMEM;
-	mm = dup_mm(tsk);
+	mm = dup_mm(current);
 	if (!mm)
 		goto fail_nomem;
 

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

* Re: [PATCH] init_new_context: Use the passed task argument
       [not found] ` <11722452452225-git-send-email-aneesh.kumar@gmail.com>
@ 2007-02-27 20:26   ` Andrew Morton
  2007-02-28  4:12     ` Aneesh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2007-02-27 20:26 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: andi, linux-kernel, aneesh.kumar

> On Fri, 23 Feb 2007 21:10:36 +0530 "Aneesh Kumar K.V" <aneesh.kumar@gmail.com> wrote:
> From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
> ---
>  arch/i386/kernel/ldt.c   |    2 +-
>  arch/x86_64/kernel/ldt.c |    2 +-
>  kernel/fork.c            |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/i386/kernel/ldt.c b/arch/i386/kernel/ldt.c
> index b410e5f..925354c 100644
> --- a/arch/i386/kernel/ldt.c
> +++ b/arch/i386/kernel/ldt.c
> @@ -97,7 +97,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
>  
>  	init_MUTEX(&mm->context.sem);
>  	mm->context.size = 0;
> -	old_mm = current->mm;
> +	old_mm = tsk->mm;
>  	if (old_mm && old_mm->context.size > 0) {
>  		down(&old_mm->context.sem);
>  		retval = copy_ldt(&mm->context, &old_mm->context);
> diff --git a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c
> index d7e5d0c..16ae79d 100644
> --- a/arch/x86_64/kernel/ldt.c
> +++ b/arch/x86_64/kernel/ldt.c
> @@ -101,7 +101,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
>  
>  	init_MUTEX(&mm->context.sem);
>  	mm->context.size = 0;
> -	old_mm = current->mm;
> +	old_mm = tsk->mm;
>  	if (old_mm && old_mm->context.size > 0) {
>  		down(&old_mm->context.sem);
>  		retval = copy_ldt(&mm->context, &old_mm->context);
> diff --git a/kernel/fork.c b/kernel/fork.c
> index d154cc7..2423d83 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -496,7 +496,7 @@ static struct mm_struct *dup_mm(struct task_struct *tsk)
>  	if (!mm_init(mm))
>  		goto fail_nomem;
>  
> -	if (init_new_context(tsk, mm))
> +	if (init_new_context(current, mm))
>  		goto fail_nocontext;

This last change makes the comment over dup_mm() wrong.  It also generally
makes dup_mm() less useful, although that migt be OK.  It also makes the
argument to dup_mm() unused and potentially removable.



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

end of thread, other threads:[~2007-02-28  4:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-28  4:47 [PATCH] init_new_context: Use the passed task argument Aneesh Kumar K.V
     [not found] <11722452363488-git-send-email-aneesh.kumar@gmail.com>
     [not found] ` <11722452452225-git-send-email-aneesh.kumar@gmail.com>
2007-02-27 20:26   ` Andrew Morton
2007-02-28  4:12     ` Aneesh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.