linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/migrate: Fix early increment of migrate->npages
@ 2017-10-02 21:44 Reza Arbab
  2017-10-02 21:48 ` Jerome Glisse
  0 siblings, 1 reply; 2+ messages in thread
From: Reza Arbab @ 2017-10-02 21:44 UTC (permalink / raw)
  To: Andrew Morton, Jérôme Glisse
  Cc: Balbir Singh, Naoya Horiguchi, Minchan Kim, Johannes Weiner,
	Kirill A. Shutemov, linux-mm, linux-kernel

The intention here is to set the same array element in src and dst.
Switch the order of these lines so that migrate->npages is only
incremented after we've used it.

Fixes: 8315ada7f095 ("mm/migrate: allow migrate_vma() to alloc new page on empty entry")
Cc: JA(C)rA'me Glisse <jglisse@redhat.com>
Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
 mm/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index dea0ceb..c4546cc 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2146,8 +2146,8 @@ static int migrate_vma_collect_hole(unsigned long start,
 	unsigned long addr;
 
 	for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) {
-		migrate->src[migrate->npages++] = MIGRATE_PFN_MIGRATE;
 		migrate->dst[migrate->npages] = 0;
+		migrate->src[migrate->npages++] = MIGRATE_PFN_MIGRATE;
 		migrate->cpages++;
 	}
 
-- 
1.8.3.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] 2+ messages in thread

* Re: [PATCH] mm/migrate: Fix early increment of migrate->npages
  2017-10-02 21:44 [PATCH] mm/migrate: Fix early increment of migrate->npages Reza Arbab
@ 2017-10-02 21:48 ` Jerome Glisse
  0 siblings, 0 replies; 2+ messages in thread
From: Jerome Glisse @ 2017-10-02 21:48 UTC (permalink / raw)
  To: Reza Arbab
  Cc: Andrew Morton, Balbir Singh, Naoya Horiguchi, Minchan Kim,
	Johannes Weiner, Kirill A. Shutemov, linux-mm, linux-kernel

On Mon, Oct 02, 2017 at 04:44:02PM -0500, Reza Arbab wrote:
> The intention here is to set the same array element in src and dst.
> Switch the order of these lines so that migrate->npages is only
> incremented after we've used it.

I already posted a fix for this today from Mark. Either version is
fine i think Andrew already pulled version i posted earlier.

> 
> Fixes: 8315ada7f095 ("mm/migrate: allow migrate_vma() to alloc new page on empty entry")
> Cc: Jerome Glisse <jglisse@redhat.com>
> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
> ---
>  mm/migrate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index dea0ceb..c4546cc 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -2146,8 +2146,8 @@ static int migrate_vma_collect_hole(unsigned long start,
>  	unsigned long addr;
>  
>  	for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) {
> -		migrate->src[migrate->npages++] = MIGRATE_PFN_MIGRATE;
>  		migrate->dst[migrate->npages] = 0;
> +		migrate->src[migrate->npages++] = MIGRATE_PFN_MIGRATE;
>  		migrate->cpages++;
>  	}
>  
> -- 
> 1.8.3.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] 2+ messages in thread

end of thread, other threads:[~2017-10-02 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 21:44 [PATCH] mm/migrate: Fix early increment of migrate->npages Reza Arbab
2017-10-02 21:48 ` Jerome Glisse

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).