+ mm-z3foldc-reinitialize-zhdr-structs-after-migration.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/z3fold.c: reinitialize zhdr structs after migration
has been added to the -mm tree.  Its filename is
     mm-z3foldc-reinitialize-zhdr-structs-after-migration.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-z3foldc-reinitialize-zhdr-structs-after-migration.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-z3foldc-reinitialize-zhdr-structs-after-migration.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Henry Burns <henryburns@xxxxxxxxxx>
Subject: mm/z3fold.c: reinitialize zhdr structs after migration

z3fold_page_migration() calls memcpy(new_zhdr, zhdr, PAGE_SIZE).  However,
zhdr contains fields that can't be directly coppied over (ex: list_head, a
circular linked list).  We only need to initialize the linked lists in
new_zhdr, as z3fold_isolate_page() already ensures that these lists are
empty

Additionally it is possible that zhdr->work has been placed in a
workqueue.  In this case we shouldn't migrate the page, as zhdr->work
references zhdr as opposed to new_zhdr.

Link: http://lkml.kernel.org/r/20190716000520.230595-1-henryburns@xxxxxxxxxx
Fixes: 1f862989b04ade61d3 ("mm/z3fold.c: support page migration")
Signed-off-by: Henry Burns <henryburns@xxxxxxxxxx>
Cc: Vitaly Vul <vitaly.vul@xxxxxxxx>
Cc: Vitaly Wool <vitalywool@xxxxxxxxx>
Cc: Shakeel Butt <shakeelb@xxxxxxxxxx>
Cc: Jonathan Adams <jwadams@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/z3fold.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/mm/z3fold.c~mm-z3foldc-reinitialize-zhdr-structs-after-migration
+++ a/mm/z3fold.c
@@ -1357,12 +1357,22 @@ static int z3fold_page_migrate(struct ad
 		z3fold_page_unlock(zhdr);
 		return -EBUSY;
 	}
+	if (work_pending(&zhdr->work)) {
+		z3fold_page_unlock(zhdr);
+		return -EAGAIN;
+	}
 	new_zhdr = page_address(newpage);
 	memcpy(new_zhdr, zhdr, PAGE_SIZE);
 	newpage->private = page->private;
 	page->private = 0;
 	z3fold_page_unlock(zhdr);
 	spin_lock_init(&new_zhdr->page_lock);
+	INIT_WORK(&new_zhdr->work, compact_page_work);
+	/*
+	 * z3fold_page_isolate() ensures that new_zhdr->buddy is empty,
+	 * so we only have to reinitialize it.
+	 */
+	INIT_LIST_HEAD(&new_zhdr->buddy);
 	new_mapping = page_mapping(page);
 	__ClearPageMovable(page);
 	ClearPagePrivate(page);
_

Patches currently in -mm which might be from henryburns@xxxxxxxxxx are

mm-z3foldc-allow-__gfp_highmem-in-z3fold_alloc.patch
mm-z3foldc-remove-z3fold_migration-trylock.patch
mm-z3foldc-reinitialize-zhdr-structs-after-migration.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux