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 10A903AD510 for ; Wed, 3 Jun 2026 16:26:25 +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=1780503987; cv=none; b=JqBEqx5gtcNnCc84XlrkvQDYkLV497bAJH3EW/hjuu9+sbO4DuY/fEW4jmAZw/RaatWmYvox73noP3+VFO1tVa9huW9zLP/1Jl2ojxmqGl6+ANSo31bKX0sCkrCXfh7SWTpAx8o7YjtZqsUnHk/CdgdKXJ5q34GJ0FdbQgWwXMw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780503987; c=relaxed/simple; bh=0A4E/HGRNZ2O4/9+qYJnmvohSbrEFg8TcYMyTTVx7mY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XZ8HMApSdwiU/5TOcewnNNGEK+JjEbNofNPojoqP+fzvzc1aj9VijCnSt2M5SBzIGlSh9jgMvk3WTreImHFY4zeXdr0ylzBlBm0A0cI0bEqWHn8EoTLboj8/0vsbOXNrNeURCXWpwmZVGqJj3vN7v26V0zgKDOGLhv+WcMIDsLQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0H+xz7NX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0H+xz7NX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7F801F00893; Wed, 3 Jun 2026 16:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780503985; bh=A1JAOUHN1/23rK1iVgjg/ko1d9g6DgERUlbDFIlv2zM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=0H+xz7NX4oJnZCyJJhIKFDBLzI8WOrvbat8wZ7+BlWqtw7z/kURDWBvu0dJBEQpQv 8TcCCtIq/hozD+OxgtcYRIyVXKW4KfRrDIHhYCXG9943BQJ6HcHjnoaKtx4yDV0hQR A7fAxNu6xDMsxLYlOvURUnMWqbO7F7PCa7ViSQUY= Date: Wed, 3 Jun 2026 18:25:27 +0200 From: Greg Kroah-Hartman To: Lorenzo Stoakes Cc: Andrew Morton , Arnd Bergmann , David Hildenbrand , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 1/3] drivers/char/mem: eliminate unnecessary use of success_hook Message-ID: <2026060313-tutor-trophy-e394@gregkh> References: <010579cca6787cf7bb057ab1f7228978b10601c8.1780397980.git.ljs@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: <010579cca6787cf7bb057ab1f7228978b10601c8.1780397980.git.ljs@kernel.org> On Tue, Jun 02, 2026 at 12:06:25PM +0100, Lorenzo Stoakes wrote: > /dev/zero, uniquely, marks memory mapped there as anonymous. This is > currently achieved using the mmap_action->success_hook. > > However this hook circumvents the abstraction of VMA initialisation so > it's preferable to do things a different way. > > To achieve this, this patch firstly defaults the VMA descriptor's vm_ops > field to the dummy VMA operations, which is what file-backed VMAs default > this field to. > > That way, we can detect whether a driver sets this field to NULL in order > to mark it anonymous. > > We then introduce vma_desc_set_anonymous() to do this explicitly, and > invoke it in mmap_zero_prepare(). > > This way, any driver which does not explicitly set desc->vm_ops, retains > the dummy vm_ops as they would previously. > > We also update set_vma_user_defined_fields() to make clear that we are > either setting vma->vm_ops to what is provided by the driver (or > defaulting to dummy_vm_ops if not set), or setting the VMA anonymous. > > This lays the groundwork for removing the success hook. > > Signed-off-by: Lorenzo Stoakes > Acked-by: David Hildenbrand (Arm) Acked-by: Greg Kroah-Hartman