From: Ming Lei <ming.lei@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>, Hannes Reinecke <hare@suse.de>,
Mark Wunderlich <mark.wunderlich@intel.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
Helge Deller <deller@gmx.de>,
John David Anglin <dave.anglin@bell.net>,
linux-block@vger.kernel.org, linux-parisc@vger.kernel.org
Subject: Re: [PATCH] block: use the __packed attribute only on architectures where it is efficient
Date: Wed, 7 Feb 2024 10:43:37 +0800 [thread overview]
Message-ID: <ZcLuWUNRZadJr0tQ@fedora> (raw)
In-Reply-To: <9651b7f-2dc5-efd7-77ca-455b4925f17b@redhat.com>
On Tue, Feb 06, 2024 at 07:31:26PM +0100, Mikulas Patocka wrote:
>
>
> On Tue, 6 Feb 2024, Ming Lei wrote:
>
> > On Tue, Feb 06, 2024 at 12:14:14PM +0100, Mikulas Patocka wrote:
> > > The __packed macro (expanding to __attribute__((__packed__))) specifies
> > > that the structure has an alignment of 1. Therefore, it may be arbitrarily
> > > misaligned. On architectures that don't have hardware support for
> > > unaligned accesses, gcc generates very inefficient code that accesses the
> > > structure fields byte-by-byte and assembles the result using shifts and
> > > ors.
> > >
> > > For example, on PA-RISC, this function is compiled to 23 instructions with
> > > the __packed attribute and only 2 instructions without the __packed
> > > attribute.
> >
> > Can you share user visible effects in this way? such as IOPS or CPU
> > utilization effect when running typical workload on null_blk or NVMe.
>
> The patch reduces total kernel size by 4096 bytes. The parisc machine
> doesn't have PCIe, so I can't test it with NVMe :)
You can run test over null-blk, which is enough to cover this report or change,
given this patch is marked as "Fixes: ", we need to understand what it fixes.
>
> > CPU is supposed to be super fast if the data is in single L1 cacheline,
> > but removing '__packed' may introduce one extra L1 cacheline load for
> > bio.
>
> Saving the intruction cache is also important. Removing the __packed
> keyword increases the bio structure size by 8 bytes - that is, L1 data
> cache consumption will be increased with the probability 8/64. And it
> reduces L1 instruction cache consumption by 84 bytes - that is one or two
> cachelines.
Yes.
But the two kinds of caches have different properties, such as:
- instruction cache has lower miss rate
- instruction cache is read only
so I'd suggest to provide null-blk test result at least.
Thanks,
Ming
prev parent reply other threads:[~2024-02-07 2:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 11:14 [PATCH] block: use the __packed attribute only on architectures where it is efficient Mikulas Patocka
2024-02-06 14:18 ` Ming Lei
2024-02-06 18:31 ` Mikulas Patocka
2024-02-07 2:43 ` Ming Lei [this message]
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=ZcLuWUNRZadJr0tQ@fedora \
--to=ming.lei@redhat.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=axboe@kernel.dk \
--cc=dave.anglin@bell.net \
--cc=deller@gmx.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=mark.wunderlich@intel.com \
--cc=mpatocka@redhat.com \
--cc=sagi@grimberg.me \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).