From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTa6w-0005p9-Sy for qemu-devel@nongnu.org; Thu, 05 Mar 2015 13:03:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTa6p-0000RJ-OS for qemu-devel@nongnu.org; Thu, 05 Mar 2015 13:03:02 -0500 Received: from mx2.parallels.com ([199.115.105.18]:60795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTa6p-0000RC-II for qemu-devel@nongnu.org; Thu, 05 Mar 2015 13:02:55 -0500 Message-ID: <54F896E6.2010800@parallels.com> Date: Thu, 5 Mar 2015 20:48:22 +0300 From: Pavel Emelyanov MIME-Version: 1.0 References: <1425575884-2574-1-git-send-email-aarcange@redhat.com> <1425575884-2574-6-git-send-email-aarcange@redhat.com> In-Reply-To: <1425575884-2574-6-git-send-email-aarcange@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/21] userfaultfd: add vm_userfaultfd_ctx to the vm_area_struct 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 > diff --git a/kernel/fork.c b/kernel/fork.c > index cf65139..cb215c0 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -425,6 +425,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) > goto fail_nomem_anon_vma_fork; > tmp->vm_flags &= ~VM_LOCKED; > tmp->vm_next = tmp->vm_prev = NULL; > + tmp->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; This creates an interesting effect when the userfaultfd is used outside of the process which created and activated one. If I try to monitor the memory usage of one task with another, once the first task fork()-s, its child begins to see zero-pages in the places where the monitor task was supposed to insert pages with data. > file = tmp->vm_file; > if (file) { > struct inode *inode = file_inode(file); > . >