From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs: do not evaluate the expression with !CONFIG_BTRFS_ASSERT
Date: Fri, 24 Jul 2020 09:57:15 -0700 [thread overview]
Message-ID: <20200724165715.GA7591@magnolia> (raw)
In-Reply-To: <20200724164147.39925-1-josef@toxicpanda.com>
On Fri, Jul 24, 2020 at 12:41:47PM -0400, Josef Bacik wrote:
> While investigating a performance issue I noticed that turning off
> CONFIG_BTRFS_ASSERT had no effect in what I was seeing in perf,
> specifically check_setget_bounds() was around 5% for this workload.
> Upon investigation I realized that I made a mistake when I added
> ASSERT(), I would still evaluate the expression, but simply ignore the
> result.
>
> This is useless, and has a marked impact on performance. This
> microbenchmark is the watered down version of an application that is
> experiencing performance issues, and does renames and creates over and
> over again. Doing these operations 200k times without this patch takes
> 13 seconds on my machine. With this patch it takes 7 seconds.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
lolz,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/btrfs/ctree.h | 2 +-
> fs/btrfs/struct-funcs.c | 2 ++
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 9c7e466f27a9..b0fe8cca7e86 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -3238,7 +3238,7 @@ static inline void assertfail(const char *expr, const char *file, int line)
>
> #else
> static inline void assertfail(const char *expr, const char* file, int line) { }
> -#define ASSERT(expr) (void)(expr)
> +#define ASSERT(expr) ((void)0)
> #endif
>
> /*
> diff --git a/fs/btrfs/struct-funcs.c b/fs/btrfs/struct-funcs.c
> index 079b059818e9..f44dc1207792 100644
> --- a/fs/btrfs/struct-funcs.c
> +++ b/fs/btrfs/struct-funcs.c
> @@ -17,6 +17,7 @@ static inline void put_unaligned_le8(u8 val, void *p)
> *(u8 *)p = val;
> }
>
> +#ifdef CONFIG_BTRFS_ASSERT
> static bool check_setget_bounds(const struct extent_buffer *eb,
> const void *ptr, unsigned off, int size)
> {
> @@ -37,6 +38,7 @@ static bool check_setget_bounds(const struct extent_buffer *eb,
>
> return true;
> }
> +#endif
>
> /*
> * Macro templates that define helpers to read/write extent buffer data of a
> --
> 2.24.1
>
next prev parent reply other threads:[~2020-07-24 16:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 16:41 [PATCH] btrfs: do not evaluate the expression with !CONFIG_BTRFS_ASSERT Josef Bacik
2020-07-24 16:57 ` Darrick J. Wong [this message]
2020-07-27 8:32 ` Johannes Thumshirn
2020-07-27 16:55 ` David Sterba
2020-07-27 17:27 ` Josef Bacik
2020-07-30 11:09 ` David Sterba
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=20200724165715.GA7591@magnolia \
--to=darrick.wong@oracle.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/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