public inbox for [email protected]
 help / color / mirror / Atom feed
From: Matthew Wilcox <[email protected]>
To: Mateusz Guzik <[email protected]>
Cc: [email protected], [email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected], [email protected]
Subject: Re: [PATCH] fs: support filename refcount without atomics
Date: Fri, 7 Mar 2025 16:26:15 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On Fri, Mar 07, 2025 at 05:11:55PM +0100, Mateusz Guzik wrote:
> +++ b/include/linux/fs.h
> @@ -2765,11 +2765,19 @@ struct audit_names;
>  struct filename {
>  	const char		*name;	/* pointer to actual string */
>  	const __user char	*uptr;	/* original userland pointer */
> -	atomic_t		refcnt;
> +	union {
> +		atomic_t	refcnt_atomic;
> +		int		refcnt;
> +	};
> +#ifdef CONFIG_DEBUG_VFS
> +	struct task_struct	*owner;
> +#endif
> +	bool			is_atomic;
>  	struct audit_names	*aname;
>  	const char		iname[];
>  };

7 (or 3) byte hole; try to pad.

Would it make more sense to put the bool between aname and iname where
it will only take one byte instead of 8?  Actually, maybe do it as:

 struct filename {
 	const char		*name;	/* pointer to actual string */
 	const __user char	*uptr;	/* original userland pointer */
-	atomic_t		refcnt;
 	struct audit_names	*aname;
+#ifdef CONFIG_DEBUG_VFS
+	struct task_struct	*owner;
+#endif
+	union {
+		atomic_t	refcnt_atomic;
+		int		refcnt;
+	};
+	bool			is_atomic;
 	const char		iname[];
 };

and (on 64-bit), you're packed even more efficiently than right now.


  parent reply	other threads:[~2025-03-07 16:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 16:11 [PATCH] fs: support filename refcount without atomics Mateusz Guzik
2025-03-07 16:18 ` Jens Axboe
2025-03-07 16:25   ` Mateusz Guzik
2025-03-07 16:32     ` Jens Axboe
2025-03-07 16:35       ` Mateusz Guzik
2025-03-07 16:38         ` Jens Axboe
2025-03-07 16:39           ` Mateusz Guzik
2025-03-07 16:26 ` Matthew Wilcox [this message]
2025-03-07 16:32   ` Mateusz Guzik
2025-03-07 16:42 ` Al Viro
2025-03-07 16:44   ` Mateusz Guzik
2025-03-07 22:58     ` Mateusz Guzik
2025-03-08 13:35 ` kernel test robot
2025-03-08 13:46 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox