Skip to contentSkip to conversation

use of activate_mm in fs/aio.c:use_mm()?

RFC PATCH In review Jeremy Fitzhardinge 3 participants 4 messages Dec 7, 2006 – Dec 9, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 use of activate_mm in fs/aio.c:use_mm()?

I'm wondering if activate_mm() is the right thing to be using in use_mm(); shouldn't this be switch_mm()?

On normal x86, they're synonymous, but for the Xen patches I'm adding a hook which assumes that activate_mm is only used the first time a new mm is used after creation (I have another hook for dealing with dup_mm). I think this use of activate_mm() is the only place where it could be used a second time on an mm.

Quoted 1 line

From a quick look at the other architectures I think this is OK (most

simply implement one in terms of the other), but some are doing some subtly different stuff between the two.

Thanks,
J

fs/aio.c +1 -1
diff -r 455b71ed4525 fs/aio.c
@@ -588,7 +588,7 @@ static void use_mm(struct mm_struct *mm)
 	 * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise
 	 * it won't work. Update it accordingly if you change it here
 	 */
-	activate_mm(active_mm, mm);
+	switch_mm(active_mm, mm);
 	task_unlock(tsk);
 
 	mmdrop(active_mm);
#1 lore raw
Quoted 9 lines · Jeremy Fitzhardinge

I'm wondering if activate_mm() is the right thing to be using in use_mm(); shouldn't this be switch_mm()?

On normal x86, they're synonymous, but for the Xen patches I'm adding a hook which assumes that activate_mm is only used the first time a new mm is used after creation (I have another hook for dealing with dup_mm). I think this use of activate_mm() is the only place where it could be used a second time on an mm.

Quoted 9 lines

From a quick look at the other architectures I think this is OK (most simply implement one in terms of the other), but some are doing some subtly different stuff between the two.

Thanks,
J

Er, lets try that again:

fs/aio.c +1 -1
diff -r 455b71ed4525 fs/aio.c
@@ -588,7 +588,7 @@ static void use_mm(struct mm_struct *mm)
 	 * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise
 	 * it won't work. Update it accordingly if you change it here
 	 */
-	activate_mm(active_mm, mm);
+	switch_mm(active_mm, mm, tsk);
 	task_unlock(tsk);
 
 	mmdrop(active_mm);
#2 lore raw
Quoted 25 lines · On Wed, 06 Dec 2006 17:36:02 -0800 Jeremy Fitzhardinge <[email protected]> wrote:
Quoted 9 lines · Jeremy Fitzhardinge

I'm wondering if activate_mm() is the right thing to be using in use_mm(); shouldn't this be switch_mm()?

On normal x86, they're synonymous, but for the Xen patches I'm adding a hook which assumes that activate_mm is only used the first time a new mm is used after creation (I have another hook for dealing with dup_mm). I think this use of activate_mm() is the only place where it could be used a second time on an mm.

Quoted 9 lines

From a quick look at the other architectures I think this is OK (most simply implement one in terms of the other), but some are doing some subtly different stuff between the two.

Thanks,
J

Er, lets try that again:

diff -r 455b71ed4525 fs/aio.c

fs/aio.c static void use_mm(struct mm_struct *mm) · line 594

Quoted 8 lines
fs/aio.c +1 -1
@@ -588,7 +588,7 @@ static void use_mm(struct mm_struct *mm)
 	 * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise
 	 * it won't work. Update it accordingly if you change it here
 	 */
-	activate_mm(active_mm, mm);
+	switch_mm(active_mm, mm, tsk);
 	task_unlock(tsk);
 
 	mmdrop(active_mm);

That to me sounds like a reasonable description of the difference between activate_mm() and switch_mm(). And the change appears reasonable as well.

But it is a change which the architecture maintainers would need to have a think about, please.

#3 lore raw

From: Andrew Morton <[email protected]>
Date: Fri, 8 Dec 2006 15:45:22 -0800

Quoted 35 lines
Quoted 32 lines · On Wed, 06 Dec 2006 17:36:02 -0800 Jeremy Fitzhardinge <[email protected]> wrote:
Quoted 9 lines · Jeremy Fitzhardinge

I'm wondering if activate_mm() is the right thing to be using in use_mm(); shouldn't this be switch_mm()?

On normal x86, they're synonymous, but for the Xen patches I'm adding a hook which assumes that activate_mm is only used the first time a new mm is used after creation (I have another hook for dealing with dup_mm). I think this use of activate_mm() is the only place where it could be used a second time on an mm.

Quoted 9 lines

From a quick look at the other architectures I think this is OK (most simply implement one in terms of the other), but some are doing some subtly different stuff between the two.

Thanks,
J

Er, lets try that again:

diff -r 455b71ed4525 fs/aio.c

fs/aio.c +1 -1
@@ -588,7 +588,7 @@ static void use_mm(struct mm_struct *mm)
 	 * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise
 	 * it won't work. Update it accordingly if you change it here
 	 */
-	activate_mm(active_mm, mm);
+	switch_mm(active_mm, mm, tsk);
 	task_unlock(tsk);
 
Quoted 7 lines

fs/aio.c static void use_mm(struct mm_struct *mm) · line 594

Quoted 1 line
fs/aio.c +0 -0
 	mmdrop(active_mm);

That to me sounds like a reasonable description of the difference between activate_mm() and switch_mm(). And the change appears reasonable as well.

But it is a change which the architecture maintainers would need to have a think about, please.

This looks absolutely correct to me.