From: Zong Li <zongbox@gmail.com>
To: torvalds@linux-foundation.org
Cc: gregkh@linuxfoundation.org, linux-riscv@lists.infradead.org,
Palmer Dabbelt <palmer@sifive.com>,
paul.walmsley@sifive.com
Subject: Re: [GIT PULL] RISC-V Patches for the 4.20 Merge Window, Part 1
Date: Sat, 27 Oct 2018 00:13:05 +0800 [thread overview]
Message-ID: <CA+ZOyagSZHXXy_ViTg7Po3qOVgUschzuvDXrhuiAkr-dg-svig@mail.gmail.com> (raw)
Message-ID: <20181026161305.BWfsagC_m33x7FD0OxB2WBO1NWQUwIHwKVE_zFpftxY@z> (raw)
In-Reply-To: <CAHk-=wiHy+39PkEjUuQRJdOO7aNytYXeAGD-tZwOfOEj6ZhTKg@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> 於 2018年10月26日 週五 上午9:51寫道:
>
> On 10/25/18 6:12 PM, Linus Torvalds wrote:
> >
> > Almost always, the 64-bit divide turns out to be entirely pointless,
> > and the code can be written as a (much cheaper) 64-by-32 divide
> > instead using the functions in <asm/div.h> instead.
>
> The other common situation for the kernel is that something was
> written as "xyz / abc", when it turns out that abc is really just a
> power-of-two.
>
> So it's not necessarily always that the 64-bit divide can be
> re-written as a 64-by-32 divide, sometimes it can be rewritten as
> simply a shift. Which is even cheaper.
>
> That's the reason I try to actively discourage full 64-by-64 divides.
> We have had situations where people end up using a divide that can
> take hundres of cycles, where alarmingly often it can be rewritten as
> one that takes tens of cycles or even just _single_ cycles.
>
> People don't sometimes appreciate just how expensive 64-by-64 divides
> are when you don't have direct hardware support for them, and how
> often there are much simpler and faster ways to avoid them.
>
Our driver guys implement the DMA driver which has a full 64-bit
divide in its initialization function. I had checked the code, it
could use the 64-by-32 divides in fact of the situation. I was not
conscious of the mistake and naively thought that umoddi3 is useful
for the other drivers which need the 64-by-64 divide. I would submit a
patch to get rid of these routines.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2018-10-26 16:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 20:42 [GIT PULL] RISC-V Patches for the 4.20 Merge Window, Part 1 Palmer Dabbelt
2018-10-24 20:42 ` Palmer Dabbelt
2018-10-26 1:12 ` Linus Torvalds
2018-10-26 1:12 ` Linus Torvalds
2018-10-26 1:35 ` Paul Walmsley
2018-10-26 1:35 ` Paul Walmsley
2018-10-26 1:51 ` Linus Torvalds
2018-10-26 1:51 ` Linus Torvalds
2018-10-26 16:13 ` Zong Li [this message]
2018-10-26 16:13 ` Zong Li
2018-10-26 16:19 ` Zong Li
2018-10-26 16:19 ` Zong Li
2018-10-26 19:32 ` Palmer Dabbelt
2018-10-26 19:32 ` Palmer Dabbelt
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=CA+ZOyagSZHXXy_ViTg7Po3qOVgUschzuvDXrhuiAkr-dg-svig@mail.gmail.com \
--to=zongbox@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@sifive.com \
--cc=paul.walmsley@sifive.com \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).