linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Cleanup migrate case in try_to_unmap_one
@ 2010-05-03 15:19 Nitin Gupta
  2010-05-13  6:04 ` KOSAKI Motohiro
  0 siblings, 1 reply; 5+ messages in thread
From: Nitin Gupta @ 2010-05-03 15:19 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KOSAKI Motohiro, Christoph Hellwig, Hugh Dickins, Rik van Riel,
	Andi Kleen, linux-kernel, linux-mm

Remove duplicate handling of TTU_MIGRATE case for
anonymous and filesystem pages.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
---
 mm/rmap.c |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 07fc947..8ccfe4a 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -946,6 +946,10 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
 			dec_mm_counter(mm, MM_FILEPAGES);
 		set_pte_at(mm, address, pte,
 				swp_entry_to_pte(make_hwpoison_entry(page)));
+	} else if (PAGE_MIGRATION && (TTU_ACTION(flags) == TTU_MIGRATION)) {
+		swp_entry_t entry;
+		entry = make_migration_entry(page, pte_write(pteval));
+		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
 	} else if (PageAnon(page)) {
 		swp_entry_t entry = { .val = page_private(page) };
 
@@ -967,22 +971,9 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
 			}
 			dec_mm_counter(mm, MM_ANONPAGES);
 			inc_mm_counter(mm, MM_SWAPENTS);
-		} else if (PAGE_MIGRATION) {
-			/*
-			 * Store the pfn of the page in a special migration
-			 * pte. do_swap_page() will wait until the migration
-			 * pte is removed and then restart fault handling.
-			 */
-			BUG_ON(TTU_ACTION(flags) != TTU_MIGRATION);
-			entry = make_migration_entry(page, pte_write(pteval));
 		}
 		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
 		BUG_ON(pte_file(*pte));
-	} else if (PAGE_MIGRATION && (TTU_ACTION(flags) == TTU_MIGRATION)) {
-		/* Establish migration entry for a file page */
-		swp_entry_t entry;
-		entry = make_migration_entry(page, pte_write(pteval));
-		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
 	} else
 		dec_mm_counter(mm, MM_FILEPAGES);
 
-- 
1.6.6.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] Cleanup migrate case in try_to_unmap_one
  2010-05-03 15:19 [PATCH] Cleanup migrate case in try_to_unmap_one Nitin Gupta
@ 2010-05-13  6:04 ` KOSAKI Motohiro
  2010-05-13  7:15   ` Nitin Gupta
  0 siblings, 1 reply; 5+ messages in thread
From: KOSAKI Motohiro @ 2010-05-13  6:04 UTC (permalink / raw)
  To: Nitin Gupta
  Cc: kosaki.motohiro, Andrew Morton, Christoph Hellwig, Hugh Dickins,
	Rik van Riel, Andi Kleen, linux-kernel, linux-mm

> Remove duplicate handling of TTU_MIGRATE case for
> anonymous and filesystem pages.
> 
> Signed-off-by: Nitin Gupta <ngupta@vflare.org>

This patch change swap cache case. I think this is not intentional.



> ---
>  mm/rmap.c |   17 ++++-------------
>  1 files changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 07fc947..8ccfe4a 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -946,6 +946,10 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
>  			dec_mm_counter(mm, MM_FILEPAGES);
>  		set_pte_at(mm, address, pte,
>  				swp_entry_to_pte(make_hwpoison_entry(page)));
> +	} else if (PAGE_MIGRATION && (TTU_ACTION(flags) == TTU_MIGRATION)) {
> +		swp_entry_t entry;
> +		entry = make_migration_entry(page, pte_write(pteval));
> +		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
>
>  	} else if (PageAnon(page)) {
>  		swp_entry_t entry = { .val = page_private(page) };
>  
> @@ -967,22 +971,9 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
>  			}
>  			dec_mm_counter(mm, MM_ANONPAGES);
>  			inc_mm_counter(mm, MM_SWAPENTS);
> -		} else if (PAGE_MIGRATION) {
> -			/*
> -			 * Store the pfn of the page in a special migration
> -			 * pte. do_swap_page() will wait until the migration
> -			 * pte is removed and then restart fault handling.
> -			 */
> -			BUG_ON(TTU_ACTION(flags) != TTU_MIGRATION);
> -			entry = make_migration_entry(page, pte_write(pteval));
>  		}
>  		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
>  		BUG_ON(pte_file(*pte));
> -	} else if (PAGE_MIGRATION && (TTU_ACTION(flags) == TTU_MIGRATION)) {
> -		/* Establish migration entry for a file page */
> -		swp_entry_t entry;
> -		entry = make_migration_entry(page, pte_write(pteval));
> -		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
>  	} else
>  		dec_mm_counter(mm, MM_FILEPAGES);
>  
> -- 
> 1.6.6.1
> 



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] Cleanup migrate case in try_to_unmap_one
  2010-05-13  6:04 ` KOSAKI Motohiro
@ 2010-05-13  7:15   ` Nitin Gupta
  2010-05-13  8:06     ` KOSAKI Motohiro
  0 siblings, 1 reply; 5+ messages in thread
From: Nitin Gupta @ 2010-05-13  7:15 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Andrew Morton, Christoph Hellwig, Hugh Dickins, Rik van Riel,
	Andi Kleen, linux-kernel, linux-mm

On 05/13/2010 11:34 AM, KOSAKI Motohiro wrote:
>> Remove duplicate handling of TTU_MIGRATE case for
>> anonymous and filesystem pages.
>>
>> Signed-off-by: Nitin Gupta <ngupta@vflare.org>
> 
> This patch change swap cache case. I think this is not intentional.
> 
> 

IIUC, we never call this function with TTU_MIGRATE for swap cache pages.
So, the behavior after this patch remains unchanged.

Thanks,
Nitin




> 
>> ---
>>  mm/rmap.c |   17 ++++-------------
>>  1 files changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git a/mm/rmap.c b/mm/rmap.c
>> index 07fc947..8ccfe4a 100644
>> --- a/mm/rmap.c
>> +++ b/mm/rmap.c
>> @@ -946,6 +946,10 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
>>  			dec_mm_counter(mm, MM_FILEPAGES);
>>  		set_pte_at(mm, address, pte,
>>  				swp_entry_to_pte(make_hwpoison_entry(page)));
>> +	} else if (PAGE_MIGRATION && (TTU_ACTION(flags) == TTU_MIGRATION)) {
>> +		swp_entry_t entry;
>> +		entry = make_migration_entry(page, pte_write(pteval));
>> +		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
>>
>>  	} else if (PageAnon(page)) {
>>  		swp_entry_t entry = { .val = page_private(page) };
>>  
>> @@ -967,22 +971,9 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
>>  			}
>>  			dec_mm_counter(mm, MM_ANONPAGES);
>>  			inc_mm_counter(mm, MM_SWAPENTS);
>> -		} else if (PAGE_MIGRATION) {
>> -			/*
>> -			 * Store the pfn of the page in a special migration
>> -			 * pte. do_swap_page() will wait until the migration
>> -			 * pte is removed and then restart fault handling.
>> -			 */
>> -			BUG_ON(TTU_ACTION(flags) != TTU_MIGRATION);
>> -			entry = make_migration_entry(page, pte_write(pteval));
>>  		}
>>  		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
>>  		BUG_ON(pte_file(*pte));
>> -	} else if (PAGE_MIGRATION && (TTU_ACTION(flags) == TTU_MIGRATION)) {
>> -		/* Establish migration entry for a file page */
>> -		swp_entry_t entry;
>> -		entry = make_migration_entry(page, pte_write(pteval));
>> -		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
>>  	} else
>>  		dec_mm_counter(mm, MM_FILEPAGES);
>>  
>> -- 
>> 1.6.6.1
>>
> 
> 
> 
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] Cleanup migrate case in try_to_unmap_one
  2010-05-13  7:15   ` Nitin Gupta
@ 2010-05-13  8:06     ` KOSAKI Motohiro
  2010-05-13  8:59       ` Nitin Gupta
  0 siblings, 1 reply; 5+ messages in thread
From: KOSAKI Motohiro @ 2010-05-13  8:06 UTC (permalink / raw)
  To: ngupta
  Cc: kosaki.motohiro, Andrew Morton, Christoph Hellwig, Hugh Dickins,
	Rik van Riel, Andi Kleen, linux-kernel, linux-mm

> On 05/13/2010 11:34 AM, KOSAKI Motohiro wrote:
> >> Remove duplicate handling of TTU_MIGRATE case for
> >> anonymous and filesystem pages.
> >>
> >> Signed-off-by: Nitin Gupta <ngupta@vflare.org>
> > 
> > This patch change swap cache case. I think this is not intentional.
> 
> IIUC, we never call this function with TTU_MIGRATE for swap cache pages.
> So, the behavior after this patch remains unchanged.

Why?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] Cleanup migrate case in try_to_unmap_one
  2010-05-13  8:06     ` KOSAKI Motohiro
@ 2010-05-13  8:59       ` Nitin Gupta
  0 siblings, 0 replies; 5+ messages in thread
From: Nitin Gupta @ 2010-05-13  8:59 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Andrew Morton, Christoph Hellwig, Hugh Dickins, Rik van Riel,
	Andi Kleen, linux-kernel, linux-mm

On 05/13/2010 01:36 PM, KOSAKI Motohiro wrote:
>> On 05/13/2010 11:34 AM, KOSAKI Motohiro wrote:
>>>> Remove duplicate handling of TTU_MIGRATE case for
>>>> anonymous and filesystem pages.
>>>>
>>>> Signed-off-by: Nitin Gupta <ngupta@vflare.org>
>>>
>>> This patch change swap cache case. I think this is not intentional.
>>
>> IIUC, we never call this function with TTU_MIGRATE for swap cache pages.
>> So, the behavior after this patch remains unchanged.
> 
> Why?
> 
> 


Kindly ignore. Looks like I misunderstood this part.
Sorry for the trouble.

Nitin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2010-05-13  9:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03 15:19 [PATCH] Cleanup migrate case in try_to_unmap_one Nitin Gupta
2010-05-13  6:04 ` KOSAKI Motohiro
2010-05-13  7:15   ` Nitin Gupta
2010-05-13  8:06     ` KOSAKI Motohiro
2010-05-13  8:59       ` Nitin Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).