From: Joe Perches <joe@perches.com>
To: Masahiro Yamada <masahiroy@kernel.org>,
Jack Brennen <jbrennen@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>, Tom Rix <trix@redhat.com>,
linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
llvm@lists.linux.dev, maskray@google.com, cleger@rivosinc.com,
kernel-team@android.com
Subject: Re: [PATCH] modpost: Optimize symbol search from linear to binary search
Date: Tue, 26 Sep 2023 00:23:57 -0700 [thread overview]
Message-ID: <f0de36d5f8f3687c873616ac3bae698f2aa61020.camel@perches.com> (raw)
In-Reply-To: <CAK7LNARd_pRWWso49C4MoahFAM9idyOFC+9ZFYdpS87CA4UTqQ@mail.gmail.com>
On Tue, 2023-09-26 at 15:46 +0900, Masahiro Yamada wrote:
> On Tue, Sep 26, 2023 at 5:59 AM Jack Brennen <jbrennen@google.com> wrote:
>
> > +Elf_Sym *symsearch_find_nearest(struct elf_info *elf, Elf_Addr addr,
> > + unsigned int secndx, bool allow_negative,
> > + Elf_Addr min_distance)
> > +{
> > + size_t hi = elf->symsearch->table_size;
> > + size_t lo = 0;
> > + struct syminfo *table = elf->symsearch->table;
> > + struct syminfo target;
> > +
> > + target.addr = addr;
> > + target.section_index = secndx;
> > + target.symbol_index = ~0; /* compares greater than any actual index */
> > + while (hi > lo) {
> > + size_t mid = lo + (hi-lo)/2; /* Avoids potential overflow */
> > +
> > + if (syminfo_compare(&table[mid], &target) > 0)
> > + hi = mid;
> > + else
> > + lo = mid+1;
>
> My preference is "low = mid + 1" over "low = mid+1"
>
> Documentation/process/coding-style.rst suggests spaces
> around binary operators.
>
> "
> Use one space around (on each side of) most binary and ternary operators,
> such as any of these::
>
> = + - < > * / % | & ^ <= >= == != ? :
> "
>
> I can see the corresponding line in the checkpatch tool:
>
> https://github.com/torvalds/linux/blob/v6.5/scripts/checkpatch.pl#L5330
>
>
> I wonder why the checkpatch did not detect it.
>
> Maybe, Joe Perches may know the reason.
checkpatch requires --strict to emit that message.
next prev parent reply other threads:[~2023-09-26 7:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 21:06 Jack Brennen
2023-09-19 19:40 ` Nick Desaulniers
2023-09-21 12:07 ` Clément Léger
2023-09-23 8:49 ` Masahiro Yamada
2023-09-23 17:21 ` Jack Brennen
2023-09-25 14:23 ` Masahiro Yamada
2023-09-24 22:20 ` Fangrui Song
2023-09-25 14:24 ` Masahiro Yamada
2023-09-25 20:52 ` Jack Brennen
2023-09-25 20:59 ` Jack Brennen
2023-09-26 6:46 ` Masahiro Yamada
2023-09-26 7:23 ` Joe Perches [this message]
2023-09-26 9:56 ` Masahiro Yamada
2023-09-26 12:40 ` Jack Brennen
2023-10-03 11:35 ` Masahiro Yamada
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=f0de36d5f8f3687c873616ac3bae698f2aa61020.camel@perches.com \
--to=joe@perches.com \
--cc=cleger@rivosinc.com \
--cc=jbrennen@google.com \
--cc=kernel-team@android.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=maskray@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=trix@redhat.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
all inboxes | Powered by JetHome®