From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84F05606C927 for ; Wed, 4 Nov 2026 19:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QJgWvTBU; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=n6uNIEN8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=bCEpJCXGgk21zgMyVrJnsb9d3IAiyaFEBDru2XgYb4M=; b=QJgWvTBUUqPuS1 fLCX5Z684AHkFtncSzhB4UM3dP+44QcXtq9BLSUxIJSPUnie4nFy2svRoMkD8n2uyrOfMRejVD/wC ma7XTZsvs7BKPfSgWVbXV2Q3Rd/M2Ez9KWDZdH0P4bJmse+NYRkQE67bE1WND1PivCZ1VvEQRw6Ig bViHoEB2YJ3nq5MR4FHeB0xFIuwwheuIEuVqp45jiIexMiQky6XAnR9eqSWEqkWYqc6e+hbztLt7Y bNm1kV8Lrp4nzdLgscbWJAT+CuySVxzoE504xPGcK4aeIe1zHo5zFRYG2DRNCCsYHBds9OXuHacNl HpGRohVP4zyDbjVi+tfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOh5Z-00000006oHd-16VO; Wed, 04 Nov 2026 19:56:05 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xOh5X-00000006oGm-1agf; Wed, 04 Nov 2026 19:56:03 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 1015F40196; Wed, 4 Nov 2026 19:56:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB9F61F00919; Wed, 4 Nov 2026 19:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793822162; bh=bCEpJCXGgk21zgMyVrJnsb9d3IAiyaFEBDru2XgYb4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=n6uNIEN8UtFFIaiDpvbvTTBdWrfLopeDookEM+XOfGJBmQaBLBud7PW4ZywRa4UqY sj9lKf00u87t0rYyILLdTAzUShhG08ZdGf/Lzb6uT5y+NXjXXOrpjMTCCufRj/+vUf qn2Hm5dCkKTQ/5xyNTYylulY92AYSZ+tzxPbaFXkvFnu/q327E+8W9jss69XVk/qWl RFW6EwVAfNKvgEJ3eedNnGhh4txPJEwh75Q839TLwgEzuVUSv49ucfVtBinxI3hk3b fb0M7feqk7mkAAGLRXxYscDizmCBmFG4sFYYV3OBo/qiimcnQoXdcT6kySNh1lRNIF bhwX+vUqpJ/hg== From: Christian Brauner To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Jann Horn , Josef Bacik , Chris Mason , Jeff Layton , NeilBrown , Eric Dumazet , Thomas Gleixner , Al Viro , Jonathan Corbet , Christoph Hellwig , Greg Kroah-Hartman , Joel Granados , Kees Cook , Jan Kara , Jan Kara , linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-um@lists.infradead.org, linux-wireless@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, ntfs3@lists.linux.dev, platform-driver-x86@vger.kernel.org, coreteam@netfilter.org, kexec@lists.infradead.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, netfilter-devel@vger.kernel.org, dri-devel@lists.freedesktop.org, ibm-acpi-devel@lists.sourceforge.net, jfs-discussion@lists.sourceforge.net, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cifs@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-usb@vger.kernel.org, samba-technical@lists.samba.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-atm-general@lists.sourceforge.net, Takashi Iwai , linux-input@vger.kernel.org, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org, linux-debuggers@vger.kernel.org, "Christian Brauner (Amutable)" , Chuck Lever Subject: [PATCH RESEND v2 25/30] alloc_tag: let procfs own the seq_file of /proc/allocinfo Date: Wed, 4 Nov 2026 20:55:48 +0100 Message-ID: <20261104-work-procfs-fs-v2-25-319e0f9a8aae@kernel.org> In-Reply-To: <20261104-work-procfs-fs-v2-0-319e0f9a8aae@kernel.org> References: <20261104-work-procfs-fs-v2-0-319e0f9a8aae@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2428; i=brauner@kernel.org; h=from:subject:message-id; bh=w2e219TOPzYhqaNEYdOja/Iy2kqKR7KfDC/oRUWRjFA=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWS97vFcddfCmyOAVbf9SsDD2QKqjkaTBOc97Z200n3GL K1V/52WdJSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAExEm5mR4fL8sPeSEVKLCxs1 t6daZRx/N59v9c2uBvbciVVGFpzdXxj+itqIaCekhc3YHW/sfpNlJ0++MIP1I9HZqYuF7+sHn5n NCgA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Content-Transfer-Encoding: 8bit X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Declare the seq_operations and the size of the private state and let procfs open and free the seq_file. ->proc_open() and ->proc_release() only set up and destroy the ioctl lock now. Signed-off-by: Christian Brauner (Amutable) --- mm/alloc_tag.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c index 7d7ad6704953..697e44468ebc 100644 --- a/mm/alloc_tag.c +++ b/mm/alloc_tag.c @@ -152,27 +152,21 @@ static const struct seq_operations allocinfo_seq_op = { }; /* - * Initializes seq_file operations and allocates private state when opening - * the /proc/allocinfo procfs entry. + * Initializes the private state when opening the /proc/allocinfo procfs + * entry. procfs opened the seq_file and allocated the state. */ static int allocinfo_open(struct inode *inode, struct file *file) { - int ret; - - ret = seq_open_private(file, &allocinfo_seq_op, - sizeof(struct allocinfo_private)); - if (!ret) { - struct seq_file *m = file->private_data; - struct allocinfo_private *priv = m->private; + struct seq_file *m = file->private_data; + struct allocinfo_private *priv = m->private; - mutex_init(&priv->ioctl_lock); - } - return ret; + mutex_init(&priv->ioctl_lock); + return 0; } /* - * Cleans up the seq_file state and frees up the private state allocated in - * allocinfo_open() when closing the /proc/allocinfo file descriptor. + * Undoes allocinfo_open() when closing the /proc/allocinfo file descriptor. + * procfs frees the seq_file and the private state. */ static int allocinfo_release(struct inode *inode, struct file *file) { @@ -180,7 +174,7 @@ static int allocinfo_release(struct inode *inode, struct file *file) struct allocinfo_private *priv = m->private; mutex_destroy(&priv->ioctl_lock); - return seq_release_private(inode, file); + return 0; } /* @@ -475,9 +469,9 @@ static long allocinfo_compat_ioctl(struct file *file, unsigned int cmd, #endif static const struct proc_ops allocinfo_proc_ops = { + .proc_seq_ops = &allocinfo_seq_op, + .proc_state_size = sizeof(struct allocinfo_private), .proc_open = allocinfo_open, - .proc_read_iter = seq_read_iter, - .proc_lseek = seq_lseek, .proc_release = allocinfo_release, .proc_ioctl = allocinfo_ioctl, #ifdef CONFIG_COMPAT -- 2.53.0