All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel@vger.kernel.org,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH] perf bench: Add benchmark of find_next_bit
Date: Wed, 29 Jul 2020 17:44:09 -0300	[thread overview]
Message-ID: <20200729204409.GF433799@kernel.org> (raw)
In-Reply-To: <20200729195918.GE433799@kernel.org>

Em Wed, Jul 29, 2020 at 04:59:18PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Jul 28, 2020 at 08:51:52AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Jul 24, 2020 at 12:19:59AM -0700, Ian Rogers escreveu:
> > > for_each_set_bit, or similar functions like for_each_cpu, may be hot
> > > within the kernel. If many bits were set then one could imagine on
> > > Intel a "bt" instruction with every bit may be faster than the function
> > > call and word length find_next_bit logic. Add a benchmark to measure
> > > this.
> > 
> > Thanks, applied.

> > > This benchmark on AMD rome and Intel skylakex shows "bt" is not a good
> > > option except for very small bitmaps.
> 
> > > +++ b/tools/perf/bench/find-bit-bench.c
> 
> > > +#if defined(__i386__) || defined(__x86_64__)
> > > +static bool asm_test_bit(long nr, const unsigned long *addr)
> > > +{
> > > +	bool oldbit;
> > > +
> > > +	asm volatile("bt %2,%1"
> > > +		     : "=@ccc" (oldbit)
> > > +		     : "m" (*(unsigned long *)addr), "Ir" (nr) : "memory");
> > > +
> > > +	return oldbit;
> 
> Some old clang versions are not liking this:

Failed with:

  clang version 3.8.0 (tags/RELEASE_380/final)
  clang version 3.8.1 (tags/RELEASE_381/final)
  clang version 4.0.0 (tags/RELEASE_400/final)
  Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
  Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
  Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
  Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)

Worked with:

  Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0)
  Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
  Alpine clang version 10.0.0 (git://git.alpinelinux.org/aports 7445adce501f8473efdb93b17b5eaf2f1445ed4c)


Also failed for;

# grep FAIL dm.log/summary  | grep -v alpine
 alt:p8: FAIL
   clang version 3.8.0 (tags/RELEASE_380/final)
 alt:p9: FAIL
   clang version 7.0.1
 amazonlinux:1: FAIL
   clang version 3.6.2 (tags/RELEASE_362/final)
 amazonlinux:2: FAIL
   clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2)
#

  reply	other threads:[~2020-07-29 20:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24  7:19 [PATCH] perf bench: Add benchmark of find_next_bit Ian Rogers
2020-07-24 14:45 ` Andi Kleen
2020-07-24 18:13   ` Ian Rogers
2020-07-28 11:51 ` Arnaldo Carvalho de Melo
2020-07-29 19:59   ` Arnaldo Carvalho de Melo
2020-07-29 20:44     ` Arnaldo Carvalho de Melo [this message]
2020-07-29 22:03       ` Ian Rogers

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=20200729204409.GF433799@kernel.org \
    --to=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.