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 7771C355057 for ; Thu, 11 Jun 2026 07:56:27 +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=1781164588; cv=none; b=RB8ihW9cGoaiqVPa9M/WuE1OIFwl+5aZBoG6WKIE/ShBZR8/iu5ocGhy8l6ly6u2OBQWmUu+Mbo+yoi7z6i3UgLf0m369fKVwvxVxiYjaPdAFVHkzmSyjf1WjJUtNfCeTj9E5r4OL1hlSvn+FK+BOR60xgkWVN3XtZk9jIs+B8s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781164588; c=relaxed/simple; bh=NeG7tM+euOqp7ATKJB8AWyhIwJxBbT4PdC3TN2s8Gx0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ReiAUvd54GRbDfE9gaarImj2dJuIG1+nbXxqeUDRHPUQKqFXGorM9SMSf0Z2w1P4mNtGF3RjM6fnYIQ1I1uKINL9qZbL3s5xOYhnkS52oAgtDOUm3b1uo/fwUezo5u0kdc+m8XZaTbLgQTKI80U7fifRIPGQ3HSaPQG0QNm3TrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TwEgXzhc; 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="TwEgXzhc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A17F21F00893; Thu, 11 Jun 2026 07:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781164587; bh=a4CUTTj1LLBvt23WQfDYUZoOfs2On1CLjSZO6t6REcI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=TwEgXzhcjfcH+o8flQYenxnUgab6Oke/RjBQ1UCEhJcTQzCdm/PVDqD6orTJmZZDd WbhwEdep3rYaoG1RwJ5Os+ni6Kj+cVXdlhaKC8tcvpKzcjW4+oDmmSBO+WKArFPM8/ ZnkZEuRIq7Jv5v9eGCiLkK7rwEYwPM4eAGP3NW71PJeS2fMAllIo1UhxzqlBWhF5Sj qrtIBCl26qjNG+BFmZIKhYRUoXhsmA1RruEjlNESbrnREzi5UvjZisqIvJfGEzYTvM nODevr95peYmmpE7aOldoG+wRiuTpjwk9Im18sJVDO+8ZNnRVYe+iYeELHj5JKTuzL HWeug/S3df66g== Date: Thu, 11 Jun 2026 09:56:20 +0200 From: "Oscar Salvador (SUSE)" To: Lorenzo Stoakes Cc: Andrew Morton , Arnd Bergmann , Greg Kroah-Hartman , 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: 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) Reviewed-by: Oscar Salvador (SUSE) -- Oscar Salvador SUSE Labs