[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cf8b0832-5545-1f09-dfc7-bd9ac1c7cc16@rasmusvillemoes.dk>
Date: Sun, 18 Mar 2018 22:32:30 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Rasmus Villemoes <linux@...musvillemoes.dk>,
Alexander Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vfs: make sure struct filename->iname is word-aligned
On 2018-03-01 00:19, Rasmus Villemoes wrote:
> I noticed that offsetof(struct filename, iname) is actually 28 on 64
> bit platforms, so we always pass an unaligned pointer to
> strncpy_from_user. This is mostly a problem for those 64 bit platforms
> without HAVE_EFFICIENT_UNALIGNED_ACCESS, but even on x86_64, unaligned
> accesses carry a penalty.
>
> A user-space microbenchmark doing nothing but strncpy_from_user from the
> same (aligned) source string runs about 5% faster when the destination
> is aligned. That number increases to 20% when the string is long
> enough (~32 bytes) that we cross a cache line boundary - that's for
> example the case for about half the files a "git status" in a kernel
> tree ends up stat'ing.
>
> This won't make any real-life workloads 5%, or even 1%, faster, but path
> lookup is common enough that cutting even a few cycles should be
> worthwhile. So ensure we always pass an aligned destination pointer to
> strncpy_from_user. Instead of explicit padding, simply swap the refcnt
> and aname members, as suggested by Al Viro.
polite ping...
Powered by blists - more mailing lists