From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DC37372EF0 for ; Wed, 20 May 2026 12:40:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779280852; cv=none; b=fkbatioFTjcN54YXtVD9HehNgFHNTu8vR/FmgEgUqacvLAuTzzBwBw1MRU4yuUgup1XAa6V8NHJstzaqForBe18XF8qcB9bsSduVtrJm26nD2xYlBS2cG6oXlJq4+OJI68DngxOu4/0gU/lXsxzqLYHmETP9v6QGZ+wUvhNtqJs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779280852; c=relaxed/simple; bh=5EPl/Mw9+vM5kYbjTzYvosAX8CwMyTZfXZu6AjXXMGc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G7WdzpnZf0JvjkkGebHgaSvFF1FOokLpvGHB7/+Bi9+6SlSJJlzhjK+HEzCAkyhm56r+5RSlGYiZe+U+Rxc2vIBF07+6jhJtmyGQbo3EKKi8xMJS/1FxwkK1/4hibb+H49VUYs0Jmq4EAYQD+oNwR8g1VJz7qeksSmkwSfMMtjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZboSrCun; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZboSrCun" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92DD41F000E9; Wed, 20 May 2026 12:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779280850; bh=hou5QTX3dwLHumKpx/wVE2F2xH1oiDUIvPBcY1JpWeo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ZboSrCunn6ZXJ4pnoJ+lf2A4PAQiOxiVvNcJ0iW/cVtmgV1vX2wHYVBcQedEmEB7+ 9G6pEas/WpUDb/DGppSiP0NSyg69d+sDGDZdWWW+Cfw3ARVwjpoenOOIApSZrVZnel RpwJAF93aulEoIZpP3FwvYb5zLGIFwJBHGWzlvooyoIUorLQ5/6esXGn3+sggTSOrF a8as6JlViBG9ukmVqdjsMrQ5QnRmfpRvzBrENluhdoNy35EsqnsieY8UJFIjMSoYGD fKIZOOtddbLWk7+D/S7x5B3hx6+9GqbBxKrS+VhbGxTlXALXYSnUfs1uha5ZmNOKS4 oI8oGtDASo6kw== Date: Wed, 20 May 2026 15:40:44 +0300 From: Mike Rapoport To: David CARLIER Cc: Andrew Morton , David Hildenbrand , Heechan Kang , "Liam R. Howlett" , Lorenzo Stoakes , Michael Bommarito , Peter Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND] userfaultfd: snapshot VMA state across UFFDIO_COPY retry Message-ID: References: <20260519052516.3315196-1-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi David, On Tue, May 19, 2026 at 06:36:23AM +0100, David CARLIER wrote: > On Tue, 19 May 2026 at 06:25, Mike Rapoport wrote: > > > @@ -69,6 +71,24 @@ static const struct vm_uffd_ops *vma_uffd_ops(struct vm_area_struct *vma) > > return vma->vm_ops ? vma->vm_ops->uffd_ops : NULL; > > } > > > > +static const struct vm_uffd_ops *vma_uffd_copy_ops(struct vm_area_struct *vma) > > > My only 2 cent, I would name it vma_uffd_effective_copy_ops() instead or > a comment to highlight it is about "UFFDIO_COPY into a MAP_PRIVATE file-backed" Too long for my taste :) And comment is useful anyway as it explains why we override the ops at all. > > +{ > > + const struct vm_uffd_ops *ops = vma_uffd_ops(vma); > > + > > + if (!ops) > > + return NULL; > > + > > + /* > > + * UFFDIO_COPY fills MAP_PRIVATE file-backed mappings as anonymous > > + * memory. This is an effective ops override, so retry validation must > > + * compare the override result, not just vma->vm_ops->uffd_ops. > > + */ > > + if (!(vma->vm_flags & VM_SHARED)) > > + return &anon_uffd_ops; > > + > > + return ops; > > +} -- Sincerely yours, Mike.