Linux Trace Kernel
 help / color / mirror / Atom feed
From: "wuqiang.matt" <wuqiang.matt@bytedance.com>
To: "Arnd Bergmann" <arnd@kernel.org>,
	 "Masami Hiramatsu" <mhiramat@kernel.org>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Yury Norov" <yury.norov@gmail.com>,
	 <linux-kernel@vger.kernel.org>,
	<linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH] objpool: fix minimum alignment of 'struct objpool_slot'
Date: Fri, 13 Feb 2026 10:15:59 +0800	[thread overview]
Message-ID: <596a5c54-a344-40ef-a995-22befe28e680@bytedance.com> (raw)
In-Reply-To: <20260210103530.3028454-1-arnd@kernel.org>

On 2026/2/10 18:35, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Members of objpool_slot get passed into try_cmpxchg_release(),
> which does not work on most architectures unless they are
> naturally aligned. Marking the structure as packed makes it
> only byte-aligned, as shown by this (normally disabled) warning:
> 
> include/linux/objpool.h:156:56: warning: taking address of packed member of 'struct objpool_slot' may result in an unaligned pointer value [-Waddress-of-packed-member]
>    156 |                 if (try_cmpxchg_release(&slot->head, &head, head + 1))
>        |                                                       ~^~~~~~~~~~~~
> 
> As the struct members are all tightly packed on all architectures,
> Just remove the '__packed annotation to give it the required
> alignment of the native word size.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   include/linux/objpool.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/objpool.h b/include/linux/objpool.h
> index b713a1fe7521..f678b35b20b1 100644
> --- a/include/linux/objpool.h
> +++ b/include/linux/objpool.h
> @@ -56,7 +56,7 @@ struct objpool_slot {
>   	uint32_t            last;
>   	uint32_t            mask;
>   	void               *entries[];
> -} __packed;
> +};
>   
>   struct objpool_head;
>   

Reviewed-by: wuqiang.matt <wuqiang.matt@bytedance.com>

Regards,
Matt Wu

           reply	other threads:[~2026-02-13  2:17 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260210103530.3028454-1-arnd@kernel.org>]

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 \
    --in-reply-to=596a5c54-a344-40ef-a995-22befe28e680@bytedance.com \
    --to=wuqiang.matt@bytedance.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=yury.norov@gmail.com \
    /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