public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Guan-Chun Wu <409411716@gms.tku.edu.tw>
To: Theodore Tso <tytso@mit.edu>
Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org,
	linux-kernel@vger.kernel.org, visitorckw@gmail.com,
	david.laight.linux@gmail.com
Subject: Re: [PATCH v2] ext4: improve str2hashbuf by processing 4-byte chunks and removing function pointers
Date: Fri, 10 Apr 2026 14:28:07 +0800	[thread overview]
Message-ID: <adiYd7APmgkR3dIi@wu-Pro-E500-G6-WS720T> (raw)
In-Reply-To: <20260409141050.GA59468@macsyma-wired.lan>

On Thu, Apr 09, 2026 at 10:10:50AM -0400, Theodore Tso wrote:
> On Sat, Nov 22, 2025 at 12:39:29PM +0800, Guan-Chun Wu wrote:
> > The original byte-by-byte implementation with modulo checks is less
> > efficient. Refactor str2hashbuf_unsigned() and str2hashbuf_signed()
> > to process input in explicit 4-byte chunks instead of using a
> > modulus-based loop to emit words byte by byte.
> > 
> > Additionally, the use of function pointers for selecting the appropriate
> > str2hashbuf implementation has been removed. Instead, the functions are
> > directly invoked based on the hash type, eliminating the overhead of
> > dynamic function calls.
> > 
> > Performance test (x86_64, Intel Core i7-10700 @ 2.90GHz, average over 10000
> > runs, using kernel module for testing):
> > 
> >     len | orig_s | new_s | orig_u | new_u
> >     ----+--------+-------+--------+-------
> >       1 |   70   |   71  |   63   |   63
> >       8 |   68   |   64  |   64   |   62
> >      32 |   75   |   70  |   75   |   63
> >      64 |   96   |   71  |  100   |   68
> >     255 |  192   |  108  |  187   |   84
> > 
> > This change improves performance, especially for larger input sizes.
> > 
> > Signed-off-by: Guan-Chun Wu <409411716@gms.tku.edu.tw>
> 
> Apologies for the delay in looking at this.  It fell through the
> cracks on my end.
> 
> Because of how I'm a bit late with reviewing patches before the merge
> window, I'm going to be very conservative in which patches I'm going
> to land.  So this is going to be deferred until the next cycle, but I
> wanted to let you know that I haven't forgotten about it.
> 
> If this was a comprehensive set of Kunit tests for fs/ext4/hash.c, I
> might have taken it.  And that's something that I would look at adding
> for the next cycle, but if you'd be interested in creating the kunit
> tests for hash.c, that would be great.
> 
> 						- Ted

Thanks for the update.

I'd be happy to add Kunit tests for fs/ext4/hash.c. I'll work on them and
send a v3 patchset with the tests and the optimization in the next cycle.

Best regards,
Guan-Chun

      reply	other threads:[~2026-04-10  6:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-22  4:39 [PATCH v2] ext4: improve str2hashbuf by processing 4-byte chunks and removing function pointers Guan-Chun Wu
2026-04-09 14:10 ` Theodore Tso
2026-04-10  6:28   ` Guan-Chun Wu [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=adiYd7APmgkR3dIi@wu-Pro-E500-G6-WS720T \
    --to=409411716@gms.tku.edu.tw \
    --cc=adilger.kernel@dilger.ca \
    --cc=david.laight.linux@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=visitorckw@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