From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTaBp-0001wl-Vl for qemu-devel@nongnu.org; Thu, 05 Mar 2015 13:08:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTaBm-0002Fd-Nu for qemu-devel@nongnu.org; Thu, 05 Mar 2015 13:08:05 -0500 Received: from mx2.parallels.com ([199.115.105.18]:36516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTaBm-0002FS-IQ for qemu-devel@nongnu.org; Thu, 05 Mar 2015 13:08:02 -0500 Message-ID: <54F89B61.308@parallels.com> Date: Thu, 5 Mar 2015 21:07:29 +0300 From: Pavel Emelyanov MIME-Version: 1.0 References: <1425575884-2574-1-git-send-email-aarcange@redhat.com> <1425575884-2574-15-git-send-email-aarcange@redhat.com> In-Reply-To: <1425575884-2574-15-git-send-email-aarcange@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 14/21] userfaultfd: mcopy_atomic|mfill_zeropage: UFFDIO_COPY|UFFDIO_ZEROPAGE preparation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrea Arcangeli , qemu-devel@nongnu.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Android Kernel Team Cc: Robert Love , Dave Hansen , Jan Kara , Neil Brown , Stefan Hajnoczi , Andrew Jones , Sanidhya Kashyap , KOSAKI Motohiro , Michel Lespinasse , Taras Glek , zhang.zhanghailiang@huawei.com, Juan Quintela , Hugh Dickins , Mel Gorman , Sasha Levin , "Dr. David Alan Gilbert" , "Huangpeng (Peter)" , Andres Lagar-Cavilla , Christopher Covington , Anthony Liguori , Paolo Bonzini , "Kirill A. Shutemov" , Keith Packard , Wenchao Xia , Andy Lutomirski , Minchan Kim , Dmitry Adamushko , Johannes Weiner , Mike Hommey , Andrew Morton , Linus Torvalds , Peter Feiner > +static int mcopy_atomic_pte(struct mm_struct *dst_mm, > + pmd_t *dst_pmd, > + struct vm_area_struct *dst_vma, > + unsigned long dst_addr, > + unsigned long src_addr) > +{ > + struct mem_cgroup *memcg; > + pte_t _dst_pte, *dst_pte; > + spinlock_t *ptl; > + struct page *page; > + void *page_kaddr; > + int ret; > + > + ret = -ENOMEM; > + page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, dst_vma, dst_addr); > + if (!page) > + goto out; Not a fatal thing, but still quite inconvenient. If there are two tasks that have anonymous private VMAs that are still not COW-ed from each other, then it will be impossible to keep the pages shared with userfault. Thus if we do post-copy memory migration for tasks, then these guys will have their memory COW-ed. Thanks, Pavel